Code

Convert memcpy(a,b,20) to hashcpy(a,b).
[git.git] / git-compat-util.h
index 3bcf5b13f2c7bab387b02bd3075629a9d14c5feb..b2e18954c03ff502053cb74d142faab7d2a8dacb 100644 (file)
@@ -139,6 +139,13 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len)
        }
 }
 
+static inline int has_extension(const char *filename, const char *ext)
+{
+       size_t len = strlen(filename);
+       size_t extlen = strlen(ext);
+       return len > extlen && !memcmp(filename + len - extlen, ext, extlen);
+}
+
 /* Sane ctype - no locale, and works with signed chars */
 #undef isspace
 #undef isdigit