Hacker News new | ask | show | jobs
by mtlmtlmtlmtl 1115 days ago
OpenBSD's libc has reallocarray for this, which is realloc with the same bounds checking as calloc, but if the first parameter is NULL, it's just calloc without the zeroing.

And I believe you'll find it in glibc too these day? Or if not, there's always libbsd, which has lots of handy stuff anyways.

1 comments

Yep, good point.