diff options
author | Måns Rullgård <mans@mansr.com> | 2010-03-06 19:41:22 +0000 |
---|---|---|
committer | Måns Rullgård <mans@mansr.com> | 2010-03-06 19:41:22 +0000 |
commit | ac6ef8682d1fe8afa9f0a3fcc9eadbad1c903937 (patch) | |
tree | dae93a928ac20857d2cf4f4dfdfbb77c2b41ce85 /libavutil/avstring.c | |
parent | a0ac950109201b3e836d85cb4c110d3fbd549343 (diff) | |
download | ffmpeg-ac6ef8682d1fe8afa9f0a3fcc9eadbad1c903937.tar.gz |
Add av_stristr() function
This is a case-insensitive version of strstr().
Originally committed as revision 22251 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/avstring.c')
-rw-r--r-- | libavutil/avstring.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libavutil/avstring.c b/libavutil/avstring.c index 6d45a9581a..4844e28db2 100644 --- a/libavutil/avstring.c +++ b/libavutil/avstring.c @@ -48,6 +48,19 @@ int av_stristart(const char *str, const char *pfx, const char **ptr) return !*pfx; } +char *av_stristr(const char *s1, const char *s2) +{ + if (!*s2) + return s1; + + do { + if (av_stristart(s1, s2, NULL)) + return s1; + } while (*s1++); + + return NULL; +} + size_t av_strlcpy(char *dst, const char *src, size_t size) { size_t len = 0; |