mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Introduce a xreallocarray and convert a few xcalloc instances that do
not require zero'ing.
This commit is contained in:
12
xmalloc.c
12
xmalloc.c
@ -61,6 +61,18 @@ xcalloc(size_t no, size_t siz)
|
||||
return(p);
|
||||
}
|
||||
|
||||
void *
|
||||
xreallocarray(void *ptr, size_t nmemb, size_t size)
|
||||
{
|
||||
void *p;
|
||||
|
||||
p = reallocarray(ptr, nmemb, size);
|
||||
if (p == NULL)
|
||||
errx(1, "xreallocarray: out of memory (new_size %zu bytes)",
|
||||
nmemb * size);
|
||||
return(p);
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(const char *str)
|
||||
{
|
||||
|
Reference in New Issue
Block a user