aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2007-02-20 01:51:22 -0800
committerJunio C Hamano <junkio@cox.net>2007-02-20 22:03:14 -0800
commitcff0302c14522ba7b34265ee39f23e6321a4777d (patch)
treed03cceec382cd4f19a1d09e9dc5f2ffbc412297a
parent9360f27ff79df898b68ee7931c701569298d1e7e (diff)
downloadgit-cff0302c14522ba7b34265ee39f23e6321a4777d.tar.gz
git-cff0302c14522ba7b34265ee39f23e6321a4777d.tar.xz
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 9863cf671..d027c36b9 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