Add strchrnul()

As suggested by Pierre Habouzit, add strchrnul().  It's a useful GNU
extension and can simplify string parser code.  There are several
places in git that can be converted to strchrnul(); as a trivial
example, this patch introduces its usage to builtin-fetch--tool.c.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe
2007-11-09 01:49:36 +01:00
committed by Junio C Hamano
parent c238dad407
commit 659c69cfef
4 changed files with 28 additions and 6 deletions

View File

@ -183,6 +183,11 @@ void *gitmemmem(const void *haystack, size_t haystacklen,
const void *needle, size_t needlelen);
#endif
#ifdef NO_STRCHRNUL
#define strchrnul gitstrchrnul
char *gitstrchrnul(const char *s, int c);
#endif
extern void release_pack_memory(size_t, int);
static inline char* xstrdup(const char *str)