diff options
author | Luca Barbato <lu_zero@gentoo.org> | 2014-07-29 14:29:13 +0100 |
---|---|---|
committer | Luca Barbato <lu_zero@gentoo.org> | 2014-07-29 17:46:29 +0200 |
commit | 69e7336b8e16ee65226fc20381baf537f4b125e6 (patch) | |
tree | efa6771a621e6187dbc09bfbc2ec1f0540a76354 /libavutil/avstring.c | |
parent | e253a9e2b3d683eb51db7c776326eb07de10ad4c (diff) | |
download | ffmpeg-69e7336b8e16ee65226fc20381baf537f4b125e6.tar.gz |
avstring: Expose the simple name match function
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavutil/avstring.c')
-rw-r--r-- | libavutil/avstring.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 3ea7be0e1d..eb5c95a01c 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -234,6 +234,26 @@ int av_isxdigit(int c) return av_isdigit(c) || (c >= 'a' && c <= 'f'); } +int av_match_name(const char *name, const char *names) +{ + const char *p; + int len, namelen; + + if (!name || !names) + return 0; + + namelen = strlen(name); + while ((p = strchr(names, ','))) { + len = FFMAX(p - names, namelen); + if (!av_strncasecmp(name, names, len)) + return 1; + names = p + 1; + } + return !av_strcasecmp(name, names); +} + + + #ifdef TEST int main(void) |