utils: mv strchrnul() to utils.h from termptyesc.c

This commit is contained in:
Boris Faure 2019-12-08 20:51:23 +01:00
parent 2bffe3c078
commit e6d3a848ef
Signed by: borisfaure
GPG Key ID: EAA9CD729F522998
2 changed files with 18 additions and 17 deletions

View File

@ -3540,23 +3540,6 @@ _eina_unicode_to_hex(Eina_Unicode u)
return -1;
}
#if !defined(HAVE_STRCHRNUL)
char *
strchrnul(const char *s, int c)
{
const char *p = s;
while (*p)
{
if (*p == c)
return (char *)p;
++p;
}
return (char *) (p);
}
#endif
static int
_xterm_parse_color(Termpty *ty, Eina_Unicode **ptr,
unsigned char *r, unsigned char *g, unsigned char *b,

View File

@ -17,6 +17,24 @@ Eina_Bool utils_need_scale_wizard(void);
#define casestartswith(str, constref) \
(!strncasecmp(str, constref, sizeof(constref) - 1))
#if !defined(HAVE_STRCHRNUL)
static inline char *
strchrnul(const char *s, int c)
{
const char *p = s;
while (*p)
{
if (*p == c)
return (char *)p;
++p;
}
return (char *) (p);
}
#endif
#if (ELM_VERSION_MAJOR == 1) && (ELM_VERSION_MINOR < 20)
# if __GNUC__ >= 7
# define EINA_FALLTHROUGH __attribute__ ((fallthrough));