mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-25 08:44:13 +00:00
Add SDL_strpbrk
This commit is contained in:
committed by
Anonymous Maarten
parent
55934bc85e
commit
baa1a5e2f4
@@ -1144,6 +1144,7 @@ SDL3_0.0.0 {
|
||||
SDL_wcsnstr;
|
||||
SDL_wcsstr;
|
||||
SDL_wcstol;
|
||||
SDL_strpbrk;
|
||||
# extra symbols go here (don't modify this line)
|
||||
local: *;
|
||||
};
|
||||
|
||||
@@ -1169,3 +1169,4 @@
|
||||
#define SDL_wcsnstr SDL_wcsnstr_REAL
|
||||
#define SDL_wcsstr SDL_wcsstr_REAL
|
||||
#define SDL_wcstol SDL_wcstol_REAL
|
||||
#define SDL_strpbrk SDL_strpbrk_REAL
|
||||
|
||||
@@ -1175,3 +1175,4 @@ SDL_DYNAPI_PROC(size_t,SDL_wcsnlen,(const wchar_t *a, size_t b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsnstr,(const wchar_t *a, const wchar_t *b, size_t c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(wchar_t*,SDL_wcsstr,(const wchar_t *a, const wchar_t *b),(a,b),return)
|
||||
SDL_DYNAPI_PROC(long,SDL_wcstol,(const wchar_t *a, wchar_t **b, int c),(a,b,c),return)
|
||||
SDL_DYNAPI_PROC(char*,SDL_strpbrk,(const char *a, const char *b),(a,b),return)
|
||||
|
||||
@@ -2401,3 +2401,22 @@ int SDL_vasprintf(char **strp, SDL_PRINTF_FORMAT_STRING const char *fmt, va_list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
char * SDL_strpbrk(const char *str, const char *breakset)
|
||||
{
|
||||
#ifdef HAVE_STRPBRK
|
||||
return strpbrk(str, breakset);
|
||||
#else
|
||||
|
||||
for (; *str; str++) {
|
||||
const char *b;
|
||||
|
||||
for (b = breakset; *b; b++) {
|
||||
if (*str == *b) {
|
||||
return (char *) str;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user