Mercurial > urweb
comparison src/c/urweb.c @ 2208:cb74460f046a
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Fri, 30 May 2014 12:00:44 -0400 |
parents | c1a62ce47083 bcda3ae88677 |
children | 0ca11d57c175 |
comparison
equal
deleted
inserted
replaced
2207:f0f7bf234893 | 2208:cb74460f046a |
---|---|
1262 } | 1262 } |
1263 | 1263 |
1264 static void align_heap(uw_context ctx) { | 1264 static void align_heap(uw_context ctx) { |
1265 size_t posn = ctx->heap.front - ctx->heap.start; | 1265 size_t posn = ctx->heap.front - ctx->heap.start; |
1266 | 1266 |
1267 if (posn % 4 != 0) { | 1267 if (posn % sizeof(void *) != 0) { |
1268 size_t bump = 4 - posn % 4; | 1268 size_t bump = sizeof(void *) - posn % sizeof(void *); |
1269 uw_check_heap(ctx, bump); | 1269 uw_check_heap(ctx, bump); |
1270 ctx->heap.front += bump; | 1270 ctx->heap.front += bump; |
1271 } | 1271 } |
1272 } | 1272 } |
1273 | 1273 |
1278 // return. | 1278 // return. |
1279 | 1279 |
1280 void *result; | 1280 void *result; |
1281 | 1281 |
1282 if (ctx->amInitializing) { | 1282 if (ctx->amInitializing) { |
1283 int error = posix_memalign(&result, 4, len); | 1283 int error = posix_memalign(&result, sizeof(void *), len); |
1284 | 1284 |
1285 if (!error) | 1285 if (!error) |
1286 return result; | 1286 return result; |
1287 else | 1287 else |
1288 uw_error(ctx, FATAL, "uw_malloc: posix_memalign() returns %d", error); | 1288 uw_error(ctx, FATAL, "uw_malloc: posix_memalign() returns %d", error); |