diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2025-02-05 12:47:06 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2025-02-05 12:47:06 +0000 |
| commit | dd01783f88902b8e33820c838fc4e6aba122b578 (patch) | |
| tree | 627a273b617d4c7dd1400f45c5e35db08e526830 /xmalloc.c | |
| parent | box-drawings: handle architecture with soft-float (diff) | |
| parent | changelog: custom regex's (diff) | |
Merge branch 'regex-mode'
Closes #1386
Closes #1872
Diffstat (limited to 'xmalloc.c')
| -rw-r--r-- | xmalloc.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -32,8 +32,17 @@ xcalloc(size_t nmemb, size_t size) void * xrealloc(void *ptr, size_t size) { + xassert(size != 0); void *alloc = realloc(ptr, size); - return unlikely(size == 0) ? alloc : check_alloc(alloc); + return check_alloc(alloc); +} + +void * +xreallocarray(void *ptr, size_t n, size_t size) +{ + xassert(n != 0 && size != 0); + void *alloc = reallocarray(ptr, n, size); + return check_alloc(alloc); } char * |
