git.99rst.org
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
| inline |
side by side
(parent:
5f95c9f
)
skip_prefix(): scan prefix only once
author
David Kastrup
<redacted>
Mon, 3 Mar 2014 23:22:15 +0000
(
00:22
+0100)
committer
Junio C Hamano
<redacted>
Mon, 3 Mar 2014 23:38:14 +0000
(15:38 -0800)
Signed-off-by: David Kastrup <redacted>
Signed-off-by: Junio C Hamano <redacted>
git-compat-util.h
patch
|
blob
|
history
diff --git
a/git-compat-util.h
b/git-compat-util.h
index cbd86c37f51c00679498107d1a05131c19afa36e..bca22ae54e7f6e48afec5683594bcd91a7812eee 100644
(file)
--- a/
git-compat-util.h
+++ b/
git-compat-util.h
@@
-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)
git clone https://git.99rst.org/PROJECT