diff options
| author | 2026-02-18 18:17:22 +0100 | |
|---|---|---|
| committer | 2026-02-18 18:19:17 +0100 | |
| commit | cc9348c999f20eaa55afde61724923f66bfa199b (patch) | |
| tree | 87b46017232b447c41523916e37501aa1fb64665 | |
| parent | 0b90de2e773f439fa606ddf2bc403d2f42fa4c3d (diff) | |
alloccopy: explicit no-op on zero size.
Allows src/dst to be null for zero size, which memcpy doesn't
| -rw-r--r-- | common.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -244,6 +244,7 @@ void *allocz(struct arena **, uint siz, uint align); static inline void * alloccopy(struct arena **arena, const void *src, uint siz, uint align) { + if (!siz) return NULL; return memcpy(alloc(arena, siz, align), src, siz); } void freearena(struct arena **); |