OSDN Git Service

Add prefixcmp()
authorJunio C Hamano <junkio@cox.net>
Tue, 20 Feb 2007 09:51:22 +0000 (01:51 -0800)
committerJunio C Hamano <junkio@cox.net>
Wed, 21 Feb 2007 06:03:14 +0000 (22:03 -0800)
We have too many strncmp(a, b, strlen(b)).

Signed-off-by: Junio C Hamano <junkio@cox.net>
git-compat-util.h

index 9863cf6..d027c36 100644 (file)
@@ -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