skip_prefix(): scan prefix only once
Signed-off-by: David Kastrup <dak@gnu.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
5f95c9f850
commit
ba399c46d9
@ -357,8 +357,11 @@ extern int suffixcmp(const char *str, const char *suffix);
|
||||
|
||||
static inline const char *skip_prefix(const char *str, const char *prefix)
|
||||
{
|
||||
size_t len = strlen(prefix);
|
||||
return strncmp(str, prefix, len) ? NULL : str + len;
|
||||
do {
|
||||
if (!*prefix)
|
||||
return str;
|
||||
} while (*str++ == *prefix++);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#if defined(NO_MMAP) || defined(USE_WIN32_MMAP)
|
||||
|
Loading…
Reference in New Issue
Block a user