diff options
author | okan <okan> | 2015-03-28 23:12:47 +0000 |
---|---|---|
committer | okan <okan> | 2015-03-28 23:12:47 +0000 |
commit | a4a414b68bf8a59255ee68959863f4c5fdee85d9 (patch) | |
tree | c612ebec85e5022479b6888b1ada2c5ad17c8eac /xmalloc.c | |
parent | 0bbe0ad98c7b8ed5d081747ee3bdb2dbf7a1b848 (diff) | |
download | cwm-a4a414b68bf8a59255ee68959863f4c5fdee85d9.tar.gz cwm-a4a414b68bf8a59255ee68959863f4c5fdee85d9.tar.xz cwm-a4a414b68bf8a59255ee68959863f4c5fdee85d9.zip |
Introduce a xreallocarray and convert a few xcalloc instances that do
not require zero'ing.
Diffstat (limited to 'xmalloc.c')
-rw-r--r-- | xmalloc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/xmalloc.c b/xmalloc.c index 2db79ab..9cf824a 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -61,6 +61,18 @@ xcalloc(size_t no, size_t siz) return(p); } +void * +xreallocarray(void *ptr, size_t nmemb, size_t size) +{ + void *p; + + p = reallocarray(ptr, nmemb, size); + if (p == NULL) + errx(1, "xreallocarray: out of memory (new_size %zu bytes)", + nmemb * size); + return(p); +} + char * xstrdup(const char *str) { |