From: mmcc Date: Sat, 17 Oct 2015 13:32:46 +0000 (+0000) Subject: Change allocarray() to areallocarray(), a full reallocarray clone. All X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=f05e542655e90830efadc028034f245b7ab13af5;p=openbsd Change allocarray() to areallocarray(), a full reallocarray clone. All the logic is already in aresize(). "Sure" nicm@ --- diff --git a/bin/ksh/alloc.c b/bin/ksh/alloc.c index 841b5afe2cf..e6eee0e0ff8 100644 --- a/bin/ksh/alloc.c +++ b/bin/ksh/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.11 2015/10/17 13:27:55 mmcc Exp $ */ +/* $OpenBSD: alloc.c,v 1.12 2015/10/17 13:32:46 mmcc Exp $ */ /* * Copyright (c) 2002 Marc Espie. * @@ -88,7 +88,7 @@ alloc(size_t size, Area *ap) #define MUL_NO_OVERFLOW (1UL << (sizeof(size_t) * 4)) void * -allocarray(size_t nmemb, size_t size, Area *ap) +areallocarray(void *ptr, size_t nmemb, size_t size, Area *ap) { /* condition logic cloned from calloc() */ if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && @@ -96,7 +96,7 @@ allocarray(size_t nmemb, size_t size, Area *ap) internal_errorf(1, "unable to allocate memory"); } - return alloc(nmemb * size, ap); + return aresize(ptr, nmemb * size, ap); } void *