summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h22
1 files changed, 7 insertions, 15 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 90464c940b..900f1cf54d 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -730,21 +730,13 @@ void *unhexmem(const char *p, size_t l);
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))
-
-#define GREEDY_REALLOC0_T(array, count, need) \
- ({ \
- size_t _size = (count) * sizeof((array)[0]); \
- void *_ptr = GREEDY_REALLOC0((array), _size, (need)); \
- if (_ptr) \
- (count) = _size / sizeof((array)[0]); \
- _ptr; \
- })
+void* greedy_realloc(void **p, size_t *allocated, size_t need, size_t size);
+void* greedy_realloc0(void **p, size_t *allocated, size_t need, size_t size);
+#define GREEDY_REALLOC(array, allocated, need) \
+ greedy_realloc((void**) &(array), &(allocated), (need), sizeof((array)[0]))
+
+#define GREEDY_REALLOC0(array, allocated, need) \
+ greedy_realloc0((void**) &(array), &(allocated), (need), sizeof((array)[0]))
static inline void _reset_errno_(int *saved_errno) {
errno = *saved_errno;