From 3b7dc27fb5497903145a52413116fad25fbaf138 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Tue, 24 Jan 2017 10:00:28 -0800 Subject: Fixed amalgamated build and added test. --- upb/upb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'upb/upb.c') diff --git a/upb/upb.c b/upb/upb.c index c24ac04..97f6c61 100644 --- a/upb/upb.c +++ b/upb/upb.c @@ -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? */ -- cgit v1.2.3