summaryrefslogtreecommitdiff
path: root/git-compat-util.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-09-26 21:39:45 (GMT)
commit1c2ea2cdc0e8c4e5af942c51b234c5af527944f6 (patch)
tree26554b52f6dcd97e2194c4b0c32106b6a2b72f92 /git-compat-util.h
parentb33000878a88b52816b97aeb88ba3677902ad277 (diff)
parent2756ca4347cbda05b16954cd7f445c216b935e76 (diff)
downloadgit-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.zip
git-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.tar.gz
git-1c2ea2cdc0e8c4e5af942c51b234c5af527944f6.tar.bz2
Merge branch 'rs/realloc-array'
Code cleanup. * rs/realloc-array: use REALLOC_ARRAY for changing the allocation size of arrays add macro REALLOC_ARRAY
Diffstat (limited to 'git-compat-util.h')
-rw-r--r--git-compat-util.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/git-compat-util.h b/git-compat-util.h
index 08a9ee2..0c4e663 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -627,6 +627,8 @@ extern int odb_mkstemp(char *template, size_t limit, const char *pattern);
extern int odb_pack_keep(char *name, size_t namesz, const unsigned char *sha1);
extern char *xgetcwd(void);
+#define REALLOC_ARRAY(x, alloc) (x) = xrealloc((x), (alloc) * sizeof(*(x)))
+
static inline size_t xsize_t(off_t len)
{
if (len > (size_t) len)