r4659 - trunk/varnish-cache/bin/varnishd
phk at varnish-cache.org
phk at varnish-cache.org
Tue Apr 13 23:07:02 CEST 2010
Author: phk
Date: 2010-04-13 23:07:01 +0200 (Tue, 13 Apr 2010)
New Revision: 4659
Modified:
trunk/varnish-cache/bin/varnishd/stevedore.c
Log:
Align pointers in allocated objects to pointer boundaries.
Modified: trunk/varnish-cache/bin/varnishd/stevedore.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-13 21:06:16 UTC (rev 4658)
+++ trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-13 21:07:01 UTC (rev 4659)
@@ -95,6 +95,9 @@
memset(o, 0, sizeof *o);
o->magic = OBJECT_MAGIC;
+ assert(PAOK(wsl));
+ assert(PAOK(lhttp));
+
o->http = HTTP_create(o + 1, nhttp);
WS_Init(o->ws_o, "obj", (char *)(o + 1) + lhttp, wsl);
WS_Assert(o->ws_o);
@@ -118,8 +121,10 @@
(void)ttl;
assert(l > 0);
+ l = PRNDUP(l);
lh = HTTP_estimate(nhttp);
+ lh = PRNDUP(lh);
if (!sp->wrk->cacheable) {
o = malloc(sizeof *o + l + lh);
@@ -135,7 +140,10 @@
o = (void *)st->ptr; /* XXX: align ? */
- STV_InitObj(sp, o, st->space - (sizeof *o + lh), lh, nhttp);
+ l = PRNDDN(st->space - (sizeof *o + lh));
+
+
+ STV_InitObj(sp, o, l, lh, nhttp);
o->objstore = st;
return (o);
}
More information about the varnish-commit
mailing list