]> asedeno.scripts.mit.edu Git - git.git/blobdiff - git-compat-util.h
Merge branch 'js/rebase-detached'
[git.git] / git-compat-util.h
index 7b29d1b905c618a50704a7b2c38041f71c942e71..ede9408bbd14880b3534110586562c2e6df8b07b 100644 (file)
@@ -183,6 +183,22 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
                 const void *needle, size_t needlelen);
 #endif
 
+#ifdef __GLIBC_PREREQ
+#if __GLIBC_PREREQ(2, 1)
+#define HAVE_STRCHRNUL
+#endif
+#endif
+
+#ifndef HAVE_STRCHRNUL
+#define strchrnul gitstrchrnul
+static inline char *gitstrchrnul(const char *s, int c)
+{
+       while (*s && *s != c)
+               s++;
+       return (char *)s;
+}
+#endif
+
 extern void release_pack_memory(size_t, int);
 
 static inline char* xstrdup(const char *str)