diff options
Diffstat (limited to 'sys/libn/memory.c')
-rw-r--r-- | sys/libn/memory.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/libn/memory.c b/sys/libn/memory.c index 7993ca2..46f2478 100644 --- a/sys/libn/memory.c +++ b/sys/libn/memory.c @@ -28,12 +28,12 @@ void * void* bufgrow(void* buf, vlong newLen, vlong eltsize) { - Assert(bufcap(buf) <= (SIZE_MAX - 1) / 2); + assert(bufcap(buf) <= (SIZE_MAX - 1) / 2); vlong newCap = MAX(16, MAX(1 + 2 * bufcap(buf), newLen)); - Assert(newLen <= newCap); - Assert(newCap <= (SIZE_MAX - offsetof(bufHdr, buf)) / eltsize); + assert(newLen <= newCap); + assert(newCap <= (SIZE_MAX - offsetof(bufHdr, buf)) / eltsize); vlong newSize = offsetof(bufHdr, buf) + newCap * eltsize; @@ -57,7 +57,7 @@ _bufpop(void *buf, int i, vlong eltsize) int n; byte *b; byte stk[1024]; - Assert(eltsize < sizeof(stk)); + assert(eltsize < sizeof(stk)); b = (byte*) buf; if (n = buflen(buf), i < n) { @@ -121,8 +121,8 @@ grow(mem·Arena *a, vlong min) a->off = blk->buf; a->end = a->off + size; - Assert(a->curr->next == nil); - Assert(a->off == ALIGN_DOWN_PTR(a->off, ARENA_ALIGN)); + assert(a->curr->next == nil); + assert(a->off == ALIGN_DOWN_PTR(a->off, ARENA_ALIGN)); a->curr->next = blk; a->curr = blk; @@ -141,14 +141,14 @@ mem·arenaalloc(mem·Arena *a, uint n, ulong size) if (size > (ulong)(a->end - a->off)) { grow(a, size); - Assert(size <= (uintptr)(a->end - a->off)); + assert(size <= (uintptr)(a->end - a->off)); } ptr = a->off; a->off = ALIGN_UP_PTR(a->off + size, ARENA_ALIGN); - Assert(a->off <= a->end); - Assert(ptr == ALIGN_DOWN_PTR(ptr, ARENA_ALIGN)); + assert(a->off <= a->end); + assert(ptr == ALIGN_DOWN_PTR(ptr, ARENA_ALIGN)); return ptr; } |