From c84f2f1b74d362054ecde1838cbc13a953cae8aa Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 16 Apr 2024 10:44:22 +0200 Subject: Rename padded_sz to nlen --- lib/alloc/arena_alloc.c | 9 ++++----- 1 file 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; } } -- cgit v1.2.3