mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-09 05:33:58 -04:00
xmalloc: add xreallocarray()
This commit is contained in:
parent
9443ac7e29
commit
aae794e9bd
2 changed files with 8 additions and 0 deletions
|
|
@ -36,6 +36,13 @@ xrealloc(void *ptr, size_t size)
|
||||||
return unlikely(size == 0) ? alloc : check_alloc(alloc);
|
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 *
|
char *
|
||||||
xstrdup(const char *str)
|
xstrdup(const char *str)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@
|
||||||
void *xmalloc(size_t size) XMALLOC;
|
void *xmalloc(size_t size) XMALLOC;
|
||||||
void *xcalloc(size_t nmemb, size_t size) XMALLOC;
|
void *xcalloc(size_t nmemb, size_t size) XMALLOC;
|
||||||
void *xrealloc(void *ptr, size_t size);
|
void *xrealloc(void *ptr, size_t size);
|
||||||
|
void *xreallocarray(void *ptr, size_t n, size_t size);
|
||||||
char *xstrdup(const char *str) XSTRDUP;
|
char *xstrdup(const char *str) XSTRDUP;
|
||||||
char *xstrndup(const char *str, size_t n) XSTRDUP;
|
char *xstrndup(const char *str, size_t n) XSTRDUP;
|
||||||
char *xasprintf(const char *format, ...) PRINTF(1) XMALLOC;
|
char *xasprintf(const char *format, ...) PRINTF(1) XMALLOC;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue