r4917 - in trunk/varnish-cache: bin/varnishd include lib/libvarnishapi
phk at varnish-cache.org
phk at varnish-cache.org
Mon Jun 7 09:46:27 CEST 2010
Author: phk
Date: 2010-06-07 09:46:27 +0200 (Mon, 07 Jun 2010)
New Revision: 4917
Modified:
trunk/varnish-cache/bin/varnishd/cache_shmlog.c
trunk/varnish-cache/include/shmlog.h
trunk/varnish-cache/lib/libvarnishapi/vsl_log.c
Log:
Sanitize macros
Modified: trunk/varnish-cache/bin/varnishd/cache_shmlog.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_shmlog.c 2010-06-06 13:54:01 UTC (rev 4916)
+++ trunk/varnish-cache/bin/varnishd/cache_shmlog.c 2010-06-07 07:46:27 UTC (rev 4917)
@@ -100,11 +100,11 @@
VSL_stats->shm_records += records;
/* Wrap if necessary */
- if (VSL_NEXT(vsl_log_nxt, len) >= vsl_log_end)
+ if (VSL_END(vsl_log_nxt, len) >= vsl_log_end)
vsl_wrap();
p = vsl_log_nxt;
- vsl_log_nxt = VSL_NEXT(vsl_log_nxt, len);
+ vsl_log_nxt = VSL_END(vsl_log_nxt, len);
*vsl_log_nxt = vsl_w0(SLT_ENDMARKER, 0);
@@ -208,12 +208,12 @@
assert(w->wlp < w->wle);
/* Wrap if necessary */
- if (VSL_NEXT(w->wlp, l) >= w->wle)
+ if (VSL_END(w->wlp, l) >= w->wle)
WSL_Flush(w, 1);
- assert (VSL_NEXT(w->wlp, l) < w->wle);
+ assert (VSL_END(w->wlp, l) < w->wle);
memcpy(VSL_DATA(w->wlp), t.b, l);
vsl_hdr(tag, w->wlp, l, id);
- w->wlp = VSL_NEXT(w->wlp, l);
+ w->wlp = VSL_END(w->wlp, l);
assert(w->wlp < w->wle);
w->wlr++;
if (params->diag_bitmap & 0x10000)
@@ -242,7 +242,7 @@
assert(w->wlp < w->wle);
/* Wrap if we cannot fit a full size record */
- if (VSL_NEXT(w->wlp, mlen) >= w->wle)
+ if (VSL_END(w->wlp, mlen) >= w->wle)
WSL_Flush(w, 1);
p = VSL_DATA(w->wlp);
@@ -250,7 +250,7 @@
if (n > mlen)
n = mlen; /* we truncate long fields */
vsl_hdr(tag, w->wlp, n, id);
- w->wlp = VSL_NEXT(w->wlp, n);
+ w->wlp = VSL_END(w->wlp, n);
assert(w->wlp < w->wle);
w->wlr++;
}
Modified: trunk/varnish-cache/include/shmlog.h
===================================================================
--- trunk/varnish-cache/include/shmlog.h 2010-06-06 13:54:01 UTC (rev 4916)
+++ trunk/varnish-cache/include/shmlog.h 2010-06-07 07:46:27 UTC (rev 4917)
@@ -97,7 +97,8 @@
*/
#define VSL_WORDS(len) (((len) + 3) / 4)
-#define VSL_NEXT(ptr, len) ((ptr) + 2 + VSL_WORDS(len))
+#define VSL_END(ptr, len) ((ptr) + 2 + VSL_WORDS(len))
+#define VSL_NEXT(ptr) VSL_END(ptr, VSL_LEN(ptr))
#define VSL_LEN(ptr) ((ptr)[0] & 0xffff)
#define VSL_TAG(ptr) ((ptr)[0] >> 24)
#define VSL_ID(ptr) ((ptr)[1])
Modified: trunk/varnish-cache/lib/libvarnishapi/vsl_log.c
===================================================================
--- trunk/varnish-cache/lib/libvarnishapi/vsl_log.c 2010-06-06 13:54:01 UTC (rev 4916)
+++ trunk/varnish-cache/lib/libvarnishapi/vsl_log.c 2010-06-07 07:46:27 UTC (rev 4917)
@@ -117,7 +117,7 @@
if (t != SLT_ENDMARKER) {
*pp = vd->log_ptr;
- vd->log_ptr = VSL_NEXT(vd->log_ptr, VSL_LEN(vd->log_ptr));
+ vd->log_ptr = VSL_NEXT(vd->log_ptr);
return (1);
}
@@ -282,7 +282,7 @@
if (!vd->d_opt && vd->r_fd == -1) {
while (VSL_TAG(vd->log_ptr) != SLT_ENDMARKER)
- vd->log_ptr = VSL_NEXT(vd->log_ptr, VSL_LEN(vd->log_ptr));
+ vd->log_ptr = VSL_NEXT(vd->log_ptr);
}
return (0);
}
More information about the varnish-commit
mailing list