t5000-tar-tree.sh: use the $( ... ) construct for command substitution
[gitweb.git] / git-compat-util.h
index 585ef8a79bd9fa66a34a840eae30658894a213f1..892032bc79b88c9180f9f4c8ba171407d7c784ed 100644 (file)
@@ -343,8 +343,11 @@ extern int ends_with(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)