mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-16 15:27:41 +00:00
Create rarch_strcasestr
This commit is contained in:
parent
fd59696f8f
commit
c94e29ed02
@ -364,3 +364,27 @@ char *rarch_strtok_r__(char *str, const char *delim, char **saveptr)
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find the first occurrence of find in s, ignore case.
|
||||
*/
|
||||
char *rarch_strcasestr(const char *s, const char *find)
|
||||
{
|
||||
char c, sc;
|
||||
size_t len;
|
||||
|
||||
if ((c = *find++) != 0)
|
||||
{
|
||||
c = tolower((unsigned char)c);
|
||||
len = strlen(find);
|
||||
do
|
||||
{
|
||||
do
|
||||
{
|
||||
if ((sc = *s++) == 0)
|
||||
return (NULL);
|
||||
}while ((char)tolower((unsigned char)sc) != c);
|
||||
}while (strncasecmp(s, find, len) != 0);
|
||||
s--;
|
||||
}
|
||||
return ((char *)s);
|
||||
}
|
||||
|
@ -44,6 +44,8 @@ extern "C" {
|
||||
size_t strlcpy(char *dest, const char *source, size_t size);
|
||||
size_t strlcat(char *dest, const char *source, size_t size);
|
||||
|
||||
char *rarch_strcasestr(const char *s, const char *find);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -210,7 +210,7 @@ static int database_info_iterate_crc_lookup(
|
||||
entry_state_crc, db_info_entry->crc32, db_info_entry->name);
|
||||
#endif
|
||||
|
||||
if (strcasestr(entry_state_crc, db_info_entry->crc32))
|
||||
if (rarch_strcasestr(entry_state_crc, db_info_entry->crc32))
|
||||
return database_info_list_iterate_found_match(db_state, db);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user