diff --git a/git-compat-util.h b/git-compat-util.h
index 93f558056dec457570bf2867dc6c75cd5891d2f2..b2e18954c03ff502053cb74d142faab7d2a8dacb 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
ret = malloc(1);
if (!ret)
die("Out of memory, malloc failed");
+#ifdef XMALLOC_POISON
+ memset(ret, 0xA5, size);
+#endif
return ret;
}
}
}
+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