mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
gallium/util: Define util_strchrnul.
Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
This commit is contained in:
parent
57c048f291
commit
0a62af3bcc
1 changed files with 18 additions and 6 deletions
|
|
@ -48,6 +48,21 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
|
||||
#define util_strchrnul strchrnul
|
||||
|
||||
#else
|
||||
|
||||
static INLINE char *
|
||||
util_strchrnul(const char *s, char c)
|
||||
{
|
||||
for (; *s && *s != c; ++s);
|
||||
|
||||
return (char *)s;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
|
|
@ -72,12 +87,9 @@ util_sprintf(char *str, const char *format, ...)
|
|||
static INLINE char *
|
||||
util_strchr(const char *s, char c)
|
||||
{
|
||||
while(*s) {
|
||||
if(*s == c)
|
||||
return (char *)s;
|
||||
++s;
|
||||
}
|
||||
return NULL;
|
||||
char *p = util_strchrnul(s, c);
|
||||
|
||||
return *p ? p : NULL;
|
||||
}
|
||||
|
||||
static INLINE char*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue