diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-20 19:55:29 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-09-20 19:55:29 +0000 |
commit | 03f37879ef167dba6f5944716c06da81902e436e (patch) | |
tree | 46a70f3d85f8de8a8a1b648a53754531b86198a6 /src/libstddjb/alloc_realloc.c | |
parent | 90c1f3c1580d8e699c2788262a614a930a33e13e (diff) | |
download | skalibs-03f37879ef167dba6f5944716c06da81902e436e.tar.xz |
We're down to ONE rogue sysdep, boys. ONE.
Diffstat (limited to 'src/libstddjb/alloc_realloc.c')
-rw-r--r-- | src/libstddjb/alloc_realloc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstddjb/alloc_realloc.c b/src/libstddjb/alloc_realloc.c new file mode 100644 index 0000000..8787291 --- /dev/null +++ b/src/libstddjb/alloc_realloc.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <stdlib.h> +#include <skalibs/alloc.h> + +int alloc_realloc (void **x, size_t n) +{ + void *y = n ? realloc(*x, n) : (free(*x), alloc(0)) ; + if (!y) return 0 ; + *x = y ; + return 1 ; +} |