From e6d3a848efd2fffd93b70d2f20082e52d2a371b0 Mon Sep 17 00:00:00 2001 From: Boris Faure Date: Sun, 8 Dec 2019 20:51:23 +0100 Subject: [PATCH] utils: mv strchrnul() to utils.h from termptyesc.c --- src/bin/termptyesc.c | 17 ----------------- src/bin/utils.h | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c index 243b8c36..604b23da 100644 --- a/src/bin/termptyesc.c +++ b/src/bin/termptyesc.c @@ -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, diff --git a/src/bin/utils.h b/src/bin/utils.h index ca5b6e79..864db508 100644 --- a/src/bin/utils.h +++ b/src/bin/utils.h @@ -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));