xmalloc: add xreallocarray()

This commit is contained in:
Daniel Eklöf 2025-01-30 09:06:24 +01:00
parent 9443ac7e29
commit aae794e9bd
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 8 additions and 0 deletions

View file

@ -36,6 +36,13 @@ xrealloc(void *ptr, size_t size)
return unlikely(size == 0) ? alloc : check_alloc(alloc);
}
void *
xreallocarray(void *ptr, size_t n, size_t size)
{
void *alloc = reallocarray(ptr, n, size);
return unlikely(size == 0) ? alloc : check_alloc(alloc);
}
char *
xstrdup(const char *str)
{