aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2014-05-28 11:53:19 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2014-05-28 11:53:19 -0400
commitfc310baba1114b1c9d10c9055ded950bb8dc64cf (patch)
treee37cdff7a7b7a98a9685f6ad39bf882a0c7f3e97 /src
parent4cee29f03879d25963e3d8a8dda879e0a007033c (diff)
Align to sizeof(void *) instead of fixed 4
Diffstat (limited to 'src')
-rw-r--r--src/c/request.c4
-rw-r--r--src/c/urweb.c6
2 files changed, 5 insertions, 5 deletions
diff --git a/src/c/request.c b/src/c/request.c
index 813d967c..5aee7bbe 100644
--- a/src/c/request.c
+++ b/src/c/request.c
@@ -212,10 +212,10 @@ void uw_request_init(uw_app *app, uw_loggers* ls) {
}
-typedef struct uw_rc {
+struct uw_rc {
size_t path_copy_size, queryString_size;
char *path_copy, *queryString;
-} *uw_request_context;
+};
uw_request_context uw_new_request_context(void) {
uw_request_context r = malloc(sizeof(struct uw_rc));
diff --git a/src/c/urweb.c b/src/c/urweb.c
index a1583f0c..e337424a 100644
--- a/src/c/urweb.c
+++ b/src/c/urweb.c
@@ -1259,8 +1259,8 @@ void uw_end_initializing(uw_context ctx) {
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 *uw_malloc(uw_context ctx, size_t len) {
void *result;
if (ctx->amInitializing) {
- int error = posix_memalign(&result, 4, len);
+ int error = posix_memalign(&result, sizeof(void *), len);
if (!error)
return result;