Mercurial > urweb
diff src/c/urweb.c @ 2017:bcda3ae88677
Align to sizeof(void *) instead of fixed 4
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 28 May 2014 11:53:19 -0400 |
parents | 4a93f379c452 |
children | 6372a742ab04 cb74460f046a |
line wrap: on
line diff
--- a/src/c/urweb.c Sun May 25 09:21:56 2014 -0400 +++ b/src/c/urweb.c Wed May 28 11:53:19 2014 -0400 @@ -1259,8 +1259,8 @@ static void align_heap(uw_context ctx) { size_t posn = ctx->heap.front - ctx->heap.start; - if (posn % 4 != 0) { - size_t bump = 4 - posn % 4; + if (posn % sizeof(void *) != 0) { + size_t bump = sizeof(void *) - posn % sizeof(void *); uw_check_heap(ctx, bump); ctx->heap.front += bump; } @@ -1275,7 +1275,7 @@ void *result; if (ctx->amInitializing) { - int error = posix_memalign(&result, 4, len); + int error = posix_memalign(&result, sizeof(void *), len); if (!error) return result;