diff options
author | Josh Haberman <jhaberman@gmail.com> | 2017-01-24 10:00:28 -0800 |
---|---|---|
committer | Josh Haberman <jhaberman@gmail.com> | 2017-01-24 10:08:06 -0800 |
commit | 3b7dc27fb5497903145a52413116fad25fbaf138 (patch) | |
tree | 09e1f9d42c000d54c31653dc9d8b9e570c41a597 /upb/upb.c | |
parent | 5aa01b46e41dcdbbd2dad6d1b7ecce9a60b8ce7a (diff) |
Fixed amalgamated build and added test.
Diffstat (limited to 'upb/upb.c')
-rw-r--r-- | upb/upb.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -104,7 +104,7 @@ upb_alloc upb_alloc_global = {&upb_global_allocfunc}; /* Be conservative and choose 16 in case anyone is using SSE. */ static const size_t maxalign = 16; -static size_t align_up(size_t size) { +static size_t align_up_max(size_t size) { return ((size + maxalign - 1) / maxalign) * maxalign; } @@ -128,7 +128,7 @@ static void upb_arena_addblock(upb_arena *a, void *ptr, size_t size, block->next = a->block_head; block->size = size; - block->used = align_up(sizeof(mem_block)); + block->used = align_up_max(sizeof(mem_block)); block->owned = owned; a->block_head = block; @@ -161,7 +161,7 @@ static void *upb_arena_doalloc(upb_alloc *alloc, void *ptr, size_t oldsize, return NULL; /* We are an arena, don't need individual frees. */ } - size = align_up(size); + size = align_up_max(size); /* TODO(haberman): special-case if this is a realloc of the last alloc? */ |