Add prefixcmp()
We have too many strncmp(a, b, strlen(b)). Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Feb 20, 2007 at 01:51 UTC
cff0302c14522ba7b34265ee39f23e6321a4777d
1 file changed
+5
git-compat-util.h
+5
@@ -279,4 +279,9 @@ static inline int sane_case(int x, int high)
279
return x;
280
}
281
282
+static inline int prefixcmp(const char *str, const char *prefix)
283
+{
284
+ return strncmp(str, prefix, strlen(prefix));
285
+}
286
+
287
#endif