From 4545a231fcccc2ef670ef70f7b38f4e0a04f86ae Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Sat, 30 Nov 2013 11:31:59 +0100 Subject: util: add greedy_realloc0() Compared to greedy_realloc(), this sets all newly allocated memory to 0. As the old variant has been used a lot for string-handling, we avoid changing it as clearing memory is not needed there. --- src/shared/util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/shared/util.h') diff --git a/src/shared/util.h b/src/shared/util.h index 1662bd4457..504f63a28f 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -669,8 +669,11 @@ char *strextend(char **x, ...) _sentinel_; char *strrep(const char *s, unsigned n); void* greedy_realloc(void **p, size_t *allocated, size_t need); +void* greedy_realloc0(void **p, size_t *allocated, size_t need); #define GREEDY_REALLOC(array, allocated, need) \ greedy_realloc((void**) &(array), &(allocated), sizeof((array)[0]) * (need)) +#define GREEDY_REALLOC0(array, allocated, need) \ + greedy_realloc0((void**) &(array), &(allocated), sizeof((array)[0]) * (need)) static inline void _reset_errno_(int *saved_errno) { errno = *saved_errno; -- cgit v1.2.3-54-g00ecf