Commit 0947f763 authored by mru's avatar mru

Add av_stristr() function

This is a case-insensitive version of strstr().

git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22251 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 37d14d8a
......@@ -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;
......
......@@ -46,6 +46,19 @@ int av_strstart(const char *str, const char *pfx, const char **ptr);
*/
int av_stristart(const char *str, const char *pfx, const char **ptr);
/**
* Locate the first case-independent occurrence in the string s1 of
* the string s2. A zero-length string s2 is considered to match at
* the start of s1.
*
* This function is a case-insensitive version of the standard strstr().
*
* @param s1 string to search in
* @param s2 string to search for
* @return pointer to the located match within s1 or a null pointer if no match
*/
char *av_stristr(const char *s1, const char *s2);
/**
* Copy the string src to dst, but no more than size - 1 bytes, and
* null-terminate dst.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment