From ef872ecb7b358af7de3611045ecd5625ce3678cd Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 18 Dec 2013 10:40:12 -0800 Subject: SQUASH??? Signed-off-by: Junio C Hamano --- git-compat-util.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/git-compat-util.h b/git-compat-util.h index b72a80d8ae..59265affd8 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -356,8 +356,11 @@ extern int suffixcmp(const char *str, const char *suffix); static inline const char *skip_prefix_defval(const char *str, const char *prefix, const char *defval) { - size_t len = strlen(prefix); - return strncmp(str, prefix, len) ? defval : str + len; + for ( ; ; str++, prefix++) + if (!*prefix) + return str; + else if (*str != *prefix) + return defval; } static inline const char *skip_prefix(const char *str, const char *prefix) -- cgit v1.2.1