From: Pierre Habouzit Date: Sun, 12 Nov 2006 12:15:44 +0000 (+0100) Subject: add m_strchrnul that does what GNU strchrnul does: search for 'c' or X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=commitdiff_plain;h=d40d2e47d8033cbf917d09c3865179870897e773;hp=334faeb80904ba5b8ced869abfea2731440d52e5 add m_strchrnul that does what GNU strchrnul does: search for 'c' or return a pointer on the NUL char if not found Signed-off-by: Pierre Habouzit --- diff --git a/lib-lib/str.h b/lib-lib/str.h index 296cd55..603e51b 100644 --- a/lib-lib/str.h +++ b/lib-lib/str.h @@ -130,6 +130,12 @@ m_strncat(char *dst, ssize_t n, const char *src, ssize_t l) { /* parsing related */ /****************************************************************************/ +static inline const char *m_strchrnul(const char *s, int c) { + while (*s && *s != c) + s++; + return s; +} + static inline const char *skipspaces(const char *s) { while (*s && isspace((unsigned char)*s)) s++;