diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-04-16 10:44:22 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-04-16 10:48:59 +0200 |
commit | c84f2f1b74d362054ecde1838cbc13a953cae8aa (patch) | |
tree | 07377615e2be34094f41b266c4c5536d61ec0d45 /lib | |
parent | ca620251b1233d9147e4820ed38871a8c23a8dc2 (diff) |
Rename padded_sz to nlen
Diffstat (limited to 'lib')
-rw-r--r-- | lib/alloc/arena_alloc.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/alloc/arena_alloc.c b/lib/alloc/arena_alloc.c index e5b99b7..eceb5b9 100644 --- a/lib/alloc/arena_alloc.c +++ b/lib/alloc/arena_alloc.c @@ -49,19 +49,18 @@ arena_alloc(arena *a, size_t sz, size_t n, size_t align) } for (struct _region *r = a->_head; r != nullptr; r = r->next) { - size_t off = pad(r->len, align); + size_t nlen, off = pad(r->len, align); /* Technically there are other ways to solve this… but at this point you might as well just fail */ - size_t padded_sz; - if (ckd_add(&padded_sz, off, sz)) { + if (ckd_add(&nlen, off, sz)) { errno = EOVERFLOW; return nullptr; } - if (padded_sz <= r->cap) { + if (nlen <= r->cap) { void *ret = (char *)r->data + off; - r->len = off + sz; + r->len = nlen; return ret; } } |