diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-09-30 19:00:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-02 18:51:05 +0200 |
commit | 0d92b0d5f445d4f26fb9d9d7cbf83c415c8d2279 (patch) | |
tree | 7bc1f0d1806583d4f387a366d00964016c0f35de /libavutil/avstring.c | |
parent | 6ea357ea83e3a821c43e05a324f7bcaa3d73076e (diff) | |
download | ffmpeg-0d92b0d5f445d4f26fb9d9d7cbf83c415c8d2279.tar.gz |
avutil/avstring: Factor av_match_list() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil/avstring.c')
-rw-r--r-- | libavutil/avstring.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/libavutil/avstring.c b/libavutil/avstring.c index fd010e407c..ac7f98ae74 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -402,6 +402,27 @@ end: return ret; } +int av_match_list(const char *name, const char *list, char separator) +{ + const char *p; + char ext1[128], *q; + int i; + + p = list; + for (i = 1;; i++) { + q = ext1; + while (*p != '\0' && *p != separator && q - ext1 < sizeof(ext1) - 1) + *q++ = *p++; + *q = '\0'; + if (!av_strcasecmp(ext1, name)) + return i; + if (*p == '\0') + break; + p++; + } + return 0; +} + #ifdef TEST int main(void) |