r2348 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jan 16 12:34:28 CET 2008
Author: phk
Date: 2008-01-16 12:34:28 +0100 (Wed, 16 Jan 2008)
New Revision: 2348
Modified:
trunk/varnish-cache/bin/varnishd/cache_http.c
trunk/varnish-cache/bin/varnishd/cache_pool.c
trunk/varnish-cache/bin/varnishd/common.h
trunk/varnish-cache/bin/varnishd/shmlog.c
Log:
Introduce the TRUST_ME() macro for voilating the C compilers pointer
sensibilities. If only they had done const right...
Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-01-16 11:27:34 UTC (rev 2347)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-01-16 11:34:28 UTC (rev 2348)
@@ -522,8 +522,8 @@
assert(n < HTTP_HDR_MAX);
AN(fm);
- to->hd[n].b = (void*)(uintptr_t)fm;
- to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
+ to->hd[n].b = TRUST_ME(fm);
+ to->hd[n].e = strchr(to->hd[n].b, '\0');
to->hdf[n] = 0;
}
Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-01-16 11:27:34 UTC (rev 2347)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-01-16 11:34:28 UTC (rev 2348)
@@ -135,7 +135,7 @@
len = strlen(ptr);
if (w->niov == MAX_IOVS)
(void)WRK_Flush(w);
- w->iov[w->niov].iov_base = (void*)(uintptr_t)ptr;
+ w->iov[w->niov].iov_base = TRUST_ME(ptr);
w->iov[w->niov].iov_len = len;
w->liov += len;
w->niov++;
Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h 2008-01-16 11:27:34 UTC (rev 2347)
+++ trunk/varnish-cache/bin/varnishd/common.h 2008-01-16 11:34:28 UTC (rev 2348)
@@ -44,3 +44,5 @@
void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen);
void TCP_myname(int sock, char *abuf, unsigned alen, char *pbuf, unsigned plen);
int TCP_filter_http(int sock);
+
+#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
Modified: trunk/varnish-cache/bin/varnishd/shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-01-16 11:27:34 UTC (rev 2347)
+++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-01-16 11:34:28 UTC (rev 2348)
@@ -77,7 +77,7 @@
}
static void
-vsl_hdr(enum shmlogtag tag, unsigned char *p, unsigned len, int id)
+vsl_hdr(enum shmlogtag tag, unsigned char *p, unsigned len, unsigned id)
{
p[__SHMLOG_LEN_HIGH] = (len >> 8) & 0xff;
@@ -142,8 +142,8 @@
va_start(ap, fmt);
if (strchr(fmt, '%') == NULL) {
- t.b = (void*)(uintptr_t)fmt;
- t.e = strchr(fmt, '\0');
+ t.b = TRUST_ME(fmt);
+ t.e = strchr(t.b, '\0');
VSLR(tag, id, t);
} else {
LOCKSHM(&vsl_mtx);
@@ -239,8 +239,8 @@
va_start(ap, fmt);
if (strchr(fmt, '%') == NULL) {
- t.b = (void*)(uintptr_t)fmt;
- t.e = strchr(fmt, '\0');
+ t.b = TRUST_ME(fmt);
+ t.e = strchr(t.b, '\0');
WSLR(w, tag, id, t);
} else {
assert(w->wlp < w->wle);
More information about the varnish-commit
mailing list