diff options
Diffstat (limited to 'utils.c')
-rw-r--r-- | utils.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -33,23 +33,25 @@ /***====================================================================***/ -Opaque -uRecalloc(Opaque old, unsigned nOld, unsigned nNew, unsigned itemSize) +#ifndef HAVE_RECALLOCARRAY +void * +uRecalloc(void *old, size_t nOld, size_t nNew, size_t itemSize) { char *rtrn; if (old == NULL) - rtrn = (char *) calloc(nNew, itemSize); + rtrn = calloc(nNew, itemSize); else { - rtrn = (char *) realloc((char *) old, nNew * itemSize); + rtrn = reallocarray(old, nNew, itemSize); if ((rtrn) && (nNew > nOld)) { bzero(&rtrn[nOld * itemSize], (nNew - nOld) * itemSize); } } - return (Opaque) rtrn; + return (void *) rtrn; } +#endif /***====================================================================***/ |