[FFmpeg-cvslog] r25626 - in trunk/libavutil: avutil.h eval.c

stefano subversion
Mon Nov 1 10:34:21 CET 2010


Author: stefano
Date: Mon Nov  1 10:34:21 2010
New Revision: 25626

Log:
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").

Modified:
   trunk/libavutil/avutil.h
   trunk/libavutil/eval.c

Modified: trunk/libavutil/avutil.h
==============================================================================
--- trunk/libavutil/avutil.h	Mon Nov  1 10:34:18 2010	(r25625)
+++ trunk/libavutil/avutil.h	Mon Nov  1 10:34:21 2010	(r25626)
@@ -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, \

Modified: trunk/libavutil/eval.c
==============================================================================
--- trunk/libavutil/eval.c	Mon Nov  1 10:34:18 2010	(r25625)
+++ trunk/libavutil/eval.c	Mon Nov  1 10:34:21 2010	(r25626)
@@ -103,13 +103,16 @@ double av_strtod(const char *numstr, cha
     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 {



More information about the ffmpeg-cvslog mailing list