summaryrefslogtreecommitdiff
path: root/libavutil/eval.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-01 09:34:21 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-11-01 09:34:21 +0000
commit4cabef0a9db40570e879d144052ad544f1a847df (patch)
tree765b28c1b797188bb1dd6085f54a9650b6759359 /libavutil/eval.c
parent2b59fbe9b1e3721ba0785fbed9fc62a8049a6830 (diff)
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
Diffstat (limited to 'libavutil/eval.c')
-rw-r--r--libavutil/eval.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavutil/eval.c b/libavutil/eval.c
index 2799160094..a4ae2695d7 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 {