mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 21:56:57 +00:00
Add xrecallocarray.
This commit is contained in:
14
xmalloc.c
14
xmalloc.c
@ -71,6 +71,20 @@ xreallocarray(void *ptr, size_t nmemb, size_t size)
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
void *
|
||||
xrecallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size)
|
||||
{
|
||||
void *new_ptr;
|
||||
|
||||
if (nmemb == 0 || size == 0)
|
||||
fatalx("xrecallocarray: zero size");
|
||||
new_ptr = recallocarray(ptr, oldnmemb, nmemb, size);
|
||||
if (new_ptr == NULL)
|
||||
fatalx("xrecallocarray: allocating %zu * %zu bytes: %s",
|
||||
nmemb, size, strerror(errno));
|
||||
return new_ptr;
|
||||
}
|
||||
|
||||
char *
|
||||
xstrdup(const char *str)
|
||||
{
|
||||
|
Reference in New Issue
Block a user