summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-20 09:51:22 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-02-21 06:03:14 (GMT)
commitcff0302c14522ba7b34265ee39f23e6321a4777d (patch)
treed03cceec382cd4f19a1d09e9dc5f2ffbc412297a
parent9360f27ff79df898b68ee7931c701569298d1e7e (diff)
downloadgit-cff0302c14522ba7b34265ee39f23e6321a4777d.zip
git-cff0302c14522ba7b34265ee39f23e6321a4777d.tar.gz
git-cff0302c14522ba7b34265ee39f23e6321a4777d.tar.bz2
Add prefixcmp()
We have too many strncmp(a, b, strlen(b)). Signed-off-by: Junio C Hamano <junkio@cox.net>
-rw-r--r--git-compat-util.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 9863cf6..d027c36 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -279,4 +279,9 @@ static inline int sane_case(int x, int high)
return x;
}
+static inline int prefixcmp(const char *str, const char *prefix)
+{
+ return strncmp(str, prefix, strlen(prefix));
+}
+
#endif