diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-12-01 21:58:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2014-12-01 21:58:47 +0000 |
commit | 63b1dc9d5d7158229afedc4c7c7db0d30a99c6b6 (patch) | |
tree | c3a9c79effa70af6f0f134fa99314869fe429e59 /usr.bin/cvs/xmalloc.c | |
parent | e0af19e7664629a09fce64e756b718edfed96da1 (diff) |
An internal function called xrealloc() is actually a fail-hard
reallocarray()... so rename it.
Diffstat (limited to 'usr.bin/cvs/xmalloc.c')
-rw-r--r-- | usr.bin/cvs/xmalloc.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/usr.bin/cvs/xmalloc.c b/usr.bin/cvs/xmalloc.c index 009ccc063a9..806cd3e1476 100644 --- a/usr.bin/cvs/xmalloc.c +++ b/usr.bin/cvs/xmalloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xmalloc.c,v 1.9 2009/06/07 08:39:13 ray Exp $ */ +/* $OpenBSD: xmalloc.c,v 1.10 2014/12/01 21:58:46 deraadt Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -51,7 +51,7 @@ xcalloc(size_t nmemb, size_t size) } void * -xrealloc(void *ptr, size_t nmemb, size_t size) +xreallocarray(void *ptr, size_t nmemb, size_t size) { void *new_ptr; size_t new_size = nmemb * size; @@ -60,10 +60,7 @@ xrealloc(void *ptr, size_t nmemb, size_t size) fatal("xrealloc: zero size"); if (SIZE_MAX / nmemb < size) fatal("xrealloc: nmemb * size > SIZE_MAX"); - if (ptr == NULL) - new_ptr = malloc(new_size); - else - new_ptr = realloc(ptr, new_size); + new_ptr = realloc(ptr, new_size); if (new_ptr == NULL) fatal("xrealloc: out of memory (new_size %lu bytes)", (u_long) new_size); |