add m_strchrnul that does what GNU strchrnul does: search for 'c' or
authorPierre Habouzit <madcoder@debian.org>
Sun, 12 Nov 2006 12:15:44 +0000 (13:15 +0100)
committerPierre Habouzit <madcoder@debian.org>
Sun, 12 Nov 2006 12:15:44 +0000 (13:15 +0100)
return a pointer on the NUL char if not found

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
lib-lib/str.h

index 296cd55..603e51b 100644 (file)
@@ -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++;