diff options
author | René Scharfe <rene.scharfe@lsrfire.ath.cx> | 2007-11-09 01:49:36 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-11-09 01:30:07 -0800 |
commit | 659c69cfef984e7416decc78841877207e9d5914 (patch) | |
tree | 498655e05588d18d81836f94ecd0de177ef610a6 /compat | |
parent | Update draft release notes for 1.5.4 (diff) | |
download | tgif-659c69cfef984e7416decc78841877207e9d5914.tar.xz |
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>
Diffstat (limited to 'compat')
-rw-r--r-- | compat/strchrnul.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compat/strchrnul.c b/compat/strchrnul.c new file mode 100644 index 0000000000..51839feb6e --- /dev/null +++ b/compat/strchrnul.c @@ -0,0 +1,8 @@ +#include "../git-compat-util.h" + +char *gitstrchrnul(const char *s, int c) +{ + while (*s && *s != c) + s++; + return (char *)s; +} |