[SCM] libav/experimental: Make strmatch() return 1 only if the string compared against the prefix does not contain other characters which may belong to an identifier.
siretart at users.alioth.debian.org
siretart at users.alioth.debian.org
Sun Jun 30 17:18:25 UTC 2013
The following commit has been merged in the experimental branch:
commit 4cabef0a9db40570e879d144052ad544f1a847df
Author: Stefano Sabatini <stefano.sabatini-lala at poste.it>
Date: Mon Nov 1 09:34:21 2010 +0000
Make strmatch() return 1 only if the string compared against the
prefix does not contain other characters which may belong to an
identifier.
This allows to distinguish for example to have different constants
with the same prefix (e.g. "foo" and "foobar").
Originally committed as revision 25626 to svn://svn.ffmpeg.org/ffmpeg/trunk
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index ba0601c..eeb0b90 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -41,7 +41,7 @@
#define LIBAVUTIL_VERSION_MAJOR 50
#define LIBAVUTIL_VERSION_MINOR 32
-#define LIBAVUTIL_VERSION_MICRO 4
+#define LIBAVUTIL_VERSION_MICRO 5
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 2799160..a4ae269 100644
--- a/libavutil/eval.c
+++ b/libavutil/eval.c
@@ -103,13 +103,16 @@ double av_strtod(const char *numstr, char **tail)
return d;
}
+#define IS_IDENTIFIER_CHAR(c) ((c) - '0' <= 9U || (c) - 'a' <= 25U || (c) - 'A' <= 25U || (c) == '_')
+
static int strmatch(const char *s, const char *prefix)
{
int i;
for (i=0; prefix[i]; i++) {
if (prefix[i] != s[i]) return 0;
}
- return 1;
+ /* return 1 only if the s identifier is terminated */
+ return !IS_IDENTIFIER_CHAR(s[i]);
}
struct AVExpr {
--
Libav/FFmpeg packaging
More information about the pkg-multimedia-commits
mailing list