summaryrefslogtreecommitdiff
path: root/libavutil/avstring.h
diff options
context:
space:
mode:
authorHenrik Gramner <henrik@gramner.com>2015-09-26 22:27:36 +0200
committerAnton Khirnov <anton@khirnov.net>2015-10-03 13:45:37 +0200
commit2c3dbff1d89bbf8300c121c06524c014cb6e0915 (patch)
tree4ee59ecc12cf45f334a7c179773d27bffb9131c6 /libavutil/avstring.h
parentf56a08559334b7eb6b3fedbc0cc741887f6067ae (diff)
avutil/avstring: Inline some tiny functions
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>
Diffstat (limited to 'libavutil/avstring.h')
-rw-r--r--libavutil/avstring.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 7c30ee18c6..780f109164 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -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.