Commit 1b0a350d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Sanitize macros



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4917 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 30b6f86a
......@@ -100,11 +100,11 @@ vsl_get(unsigned len, unsigned records, unsigned flushes)
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 @@ WSLR(struct worker *w, enum shmlogtag tag, int id, txt t)
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 @@ WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...)
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 @@ WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...)
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++;
}
......
......@@ -97,7 +97,8 @@ struct shmloghead {
*/
#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])
......
......@@ -117,7 +117,7 @@ vsl_nextlog(struct VSL_data *vd, uint32_t **pp)
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 @@ VSL_OpenLog(struct VSL_data *vd)
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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment