[FFmpeg-cvslog] avutil/avstring: Inline some tiny functions
Henrik Gramner
git at videolan.org
Mon Oct 5 11:17:31 CEST 2015
ffmpeg | branch: master | Henrik Gramner <henrik at gramner.com> | Sat Sep 26 22:27:36 2015 +0200| [2c3dbff1d89bbf8300c121c06524c014cb6e0915] | committer: Anton Khirnov
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 at khirnov.net>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c3dbff1d89bbf8300c121c06524c014cb6e0915
---
libavutil/avstring.c | 22 ----------------------
libavutil/avstring.h | 22 ++++++++++++++++++----
2 files changed, 18 insertions(+), 26 deletions(-)
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index eb5c95a..5a443ab 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -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;
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index 7c30ee1..780f109 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.
More information about the ffmpeg-cvslog
mailing list