diff options
author | Yuri Pankov <yuri.pankov@nexenta.com> | 2017-07-28 14:44:18 +0300 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2017-07-29 22:55:08 +0000 |
commit | f1cdbd3731f01314c1d46f05280ad63f1770fdc6 (patch) | |
tree | c5a25b595ef96005afa9734a6347a7e910c5b9b2 /usr/src/lib/libc/port/gen/reallocarray.c | |
parent | 0b905b49d460a57773d88d714cd880ffe0182b7c (diff) | |
download | illumos-joyent-f1cdbd3731f01314c1d46f05280ad63f1770fdc6.tar.gz |
8546 want recallocarray(3C) and freezero(3C)
Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Diffstat (limited to 'usr/src/lib/libc/port/gen/reallocarray.c')
-rw-r--r-- | usr/src/lib/libc/port/gen/reallocarray.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/usr/src/lib/libc/port/gen/reallocarray.c b/usr/src/lib/libc/port/gen/reallocarray.c index ecc4d25fa9..ba1f028c42 100644 --- a/usr/src/lib/libc/port/gen/reallocarray.c +++ b/usr/src/lib/libc/port/gen/reallocarray.c @@ -26,12 +26,12 @@ #define MUL_NO_OVERFLOW ((size_t)1 << (sizeof (size_t) * 4)) void * -reallocarray(void *optr, size_t nmemb, size_t size) +reallocarray(void *ptr, size_t nelem, size_t elsize) { - if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && - nmemb > 0 && SIZE_MAX / nmemb < size) { + if ((nelem >= MUL_NO_OVERFLOW || elsize >= MUL_NO_OVERFLOW) && + nelem > 0 && SIZE_MAX / nelem < elsize) { errno = ENOMEM; return (NULL); } - return (realloc(optr, size * nmemb)); + return (realloc(ptr, elsize * nelem)); } |