Merge branch 'jc/diff-format-doc' into maint
[gitweb.git] / git-compat-util.h
index dcecd857f159357ff7d79cde218895f43795d944..553fc017623be771878778c84aca08a4684f6902 100644 (file)
@@ -218,6 +218,9 @@ extern char *gitbasename(char *);
 #include <openssl/err.h>
 #undef MAC_OS_X_VERSION_MIN_REQUIRED
 #undef __AVAILABILITY_MACROS_USES_AVAILABILITY
+#ifdef NO_HMAC_CTX_CLEANUP
+#define HMAC_CTX_cleanup HMAC_cleanup
+#endif
 #endif
 
 /* On most systems <netdb.h> would have given us this, but
@@ -675,6 +678,11 @@ extern char *xgetcwd(void);
 
 #define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), (alloc) * sizeof(*(x)))
 
+static inline char *xstrdup_or_null(const char *str)
+{
+       return str ? xstrdup(str) : NULL;
+}
+
 static inline size_t xsize_t(off_t len)
 {
        if (len > (size_t) len)