]> git.sesse.net Git - ffmpeg/commitdiff
avutil/avstring: Inline some tiny functions
authorHenrik Gramner <henrik@gramner.com>
Sat, 26 Sep 2015 20:27:36 +0000 (22:27 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sat, 3 Oct 2015 11:45:37 +0000 (13:45 +0200)
They're short enough that inlining them actually reduces code size due to
all the overhead associated with making a function call.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavutil/avstring.c
libavutil/avstring.h

index eb5c95a01c78f03af47aad39befc39f3e2640454..5a443ab11b7f0994c5487ea78bca82255f4d6c9f 100644 (file)
@@ -212,28 +212,6 @@ const char *av_dirname(char *path)
     return path;
 }
 
-int av_isdigit(int c)
-{
-    return c >= '0' && c <= '9';
-}
-
-int av_isgraph(int c)
-{
-    return c > 32 && c < 127;
-}
-
-int av_isspace(int c)
-{
-    return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
-           c == '\v';
-}
-
-int av_isxdigit(int c)
-{
-    c = av_tolower(c);
-    return av_isdigit(c) || (c >= 'a' && c <= 'f');
-}
-
 int av_match_name(const char *name, const char *names)
 {
     const char *p;
index 7c30ee18c608b9191660c6a282fc7b921e675c54..780f109164506c4db7bfdca49e7b64948ac4f959 100644 (file)
@@ -154,17 +154,27 @@ char *av_get_token(const char **buf, const char *term);
 /**
  * Locale-independent conversion of ASCII isdigit.
  */
-av_const int av_isdigit(int c);
+static inline av_const int av_isdigit(int c)
+{
+    return c >= '0' && c <= '9';
+}
 
 /**
  * Locale-independent conversion of ASCII isgraph.
  */
-av_const int av_isgraph(int c);
+static inline av_const int av_isgraph(int c)
+{
+    return c > 32 && c < 127;
+}
 
 /**
  * Locale-independent conversion of ASCII isspace.
  */
-av_const int av_isspace(int c);
+static inline av_const int av_isspace(int c)
+{
+    return c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' ||
+           c == '\v';
+}
 
 /**
  * Locale-independent conversion of ASCII characters to uppercase.
@@ -189,7 +199,11 @@ static inline av_const int av_tolower(int c)
 /**
  * Locale-independent conversion of ASCII isxdigit.
  */
-av_const int av_isxdigit(int c);
+static inline av_const int av_isxdigit(int c)
+{
+    c = av_tolower(c);
+    return av_isdigit(c) || (c >= 'a' && c <= 'f');
+}
 
 /*
  * Locale-independent case-insensitive compare.