version 1.3, 2007/02/27 07:59:13 |
version 1.4, 2009/06/07 08:39:13 |
|
|
|
|
if (size == 0 || nmemb == 0) |
if (size == 0 || nmemb == 0) |
errx(1, "xcalloc: zero size"); |
errx(1, "xcalloc: zero size"); |
if (SIZE_T_MAX / nmemb < size) |
if (SIZE_MAX / nmemb < size) |
errx(1, "xcalloc: nmemb * size > SIZE_T_MAX"); |
errx(1, "xcalloc: nmemb * size > SIZE_MAX"); |
ptr = calloc(nmemb, size); |
ptr = calloc(nmemb, size); |
if (ptr == NULL) |
if (ptr == NULL) |
errx(1, "xcalloc: out of memory (allocating %lu bytes)", |
errx(1, "xcalloc: out of memory (allocating %lu bytes)", |
|
|
|
|
if (new_size == 0) |
if (new_size == 0) |
errx(1, "xrealloc: zero size"); |
errx(1, "xrealloc: zero size"); |
if (SIZE_T_MAX / nmemb < size) |
if (SIZE_MAX / nmemb < size) |
errx(1, "xrealloc: nmemb * size > SIZE_T_MAX"); |
errx(1, "xrealloc: nmemb * size > SIZE_MAX"); |
if (ptr == NULL) |
if (ptr == NULL) |
new_ptr = malloc(new_size); |
new_ptr = malloc(new_size); |
else |
else |