This makes the code easier to understand and slightly faster,
but requires C23. calloc() would benefit, too, but I didn't
want to touch the imported jemalloc code base.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
lib/libopenbsd/recallocarray.c | ||
---|---|---|
36 | I would wrote if (ckd_mul(&newsize, newnmemb, size) || ckd_mul(&oldsize, oldnmemb, size)) { errno = EINVAL; return NULL; } since there are much simpler conditions now. |
lib/libopenbsd/recallocarray.c | ||
---|---|---|
36 | This cannot be done as one needs to fail with ENOMEM while the other fails with EINVAL. |
lib/libopenbsd/recallocarray.c | ||
---|---|---|
36 | Indeed, missed that. |