eeshow/misc/util.h (realloc_size, realloc_type_n): get rid of bare "realloc"

Finally ! Shoulds have done this a long time ago.
This commit is contained in:
Werner Almesberger committed 2016-08-22 21:00:40 -03:00
1 parent 1b250bd467
commit 465a36fde5
9 files changed
+25 -29

No files matched your search

+12
View File
@@ -30,6 +30,18 @@
#define alloc_type(t) ((t *) alloc_size(sizeof(t)))
#define alloc_type_n(t, n) ((t *) alloc_size(sizeof(t) * (n)))
#define realloc_size(p, s) \
({ void *alloc_size_tmp = realloc((p), (s)); \
if (!alloc_size_tmp) { \
perror("realloc"); \
exit(1); \
} \
alloc_size_tmp; })
#define realloc_type_n(p, t, n) ((t *) realloc_size((p), sizeof(t) * (n)))
#define stralloc(s) \
({ char *stralloc_tmp = strdup(s); \
if (!stralloc_tmp) { \