Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xdiff/xmacros.h')
-rw-r--r--xdiff/xmacros.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/xdiff/xmacros.h b/xdiff/xmacros.h
index ae4636c247..9fd3c5da91 100644
--- a/xdiff/xmacros.h
+++ b/xdiff/xmacros.h
@@ -49,5 +49,10 @@ do { \
((unsigned long) __p[2]) << 16 | ((unsigned long) __p[3]) << 24; \
} while (0)
+/* Allocate an array of nr elements, returns NULL on failure */
+#define XDL_ALLOC_ARRAY(p, nr) \
+ ((p) = SIZE_MAX / sizeof(*(p)) >= (size_t)(nr) \
+ ? xdl_malloc((nr) * sizeof(*(p))) \
+ : NULL)
#endif /* #if !defined(XMACROS_H) */