[master] a5f1147 Prompted by symbols visibility issues with libvarnishapi (#926) we need some long overdue name-space cleanups.
Poul-Henning Kamp
phk at varnish-cache.org
Tue May 31 13:15:01 CEST 2011
commit a5f11476e4a6c13b42fded340ee1626feecb105e
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 31 07:39:13 2011 +0000
Prompted by symbols visibility issues with libvarnishapi (#926)
we need some long overdue name-space cleanups.
In general, the idea is that symbols we export are prefixed
V[A-Z][A-Z], but some notable exceptions have existed until now,
but will now be corrected.
Here: vsb_ -> VSB_
diff --git a/bin/varnishd/cache_backend_poll.c b/bin/varnishd/cache_backend_poll.c
index 543840a..61ed687 100644
--- a/bin/varnishd/cache_backend_poll.c
+++ b/bin/varnishd/cache_backend_poll.c
@@ -308,18 +308,18 @@ vbp_build_req(struct vsb *vsb, const struct vbp_vcl *vcl)
XXXAN(vsb);
XXXAN(vcl);
- vsb_clear(vsb);
+ VSB_clear(vsb);
if(vcl->probe.request != NULL) {
- vsb_cat(vsb, vcl->probe.request);
+ VSB_cat(vsb, vcl->probe.request);
} else {
- vsb_printf(vsb, "GET %s HTTP/1.1\r\n",
+ VSB_printf(vsb, "GET %s HTTP/1.1\r\n",
vcl->probe.url != NULL ? vcl->probe.url : "/");
if (vcl->hosthdr != NULL)
- vsb_printf(vsb, "Host: %s\r\n", vcl->hosthdr);
- vsb_printf(vsb, "Connection: close\r\n");
- vsb_printf(vsb, "\r\n");
+ VSB_printf(vsb, "Host: %s\r\n", vcl->hosthdr);
+ VSB_printf(vsb, "Connection: close\r\n");
+ VSB_printf(vsb, "\r\n");
}
- AZ(vsb_finish(vsb));
+ AZ(VSB_finish(vsb));
}
/*--------------------------------------------------------------------
@@ -345,8 +345,8 @@ vbp_wrk_poll_backend(void *priv)
}
Lck_Unlock(&vbp_mtx);
- vt->req = vsb_data(vt->vsb);
- vt->req_len = vsb_len(vt->vsb);
+ vt->req = VSB_data(vt->vsb);
+ vt->req_len = VSB_len(vt->vsb);
vbp_start_poke(vt);
vbp_poke(vt);
@@ -484,7 +484,7 @@ VBP_Start(struct backend *b, const struct vrt_backend_probe *p, const char *host
XXXAN(vt);
VTAILQ_INIT(&vt->vcls);
vt->backend = b;
- vt->vsb = vsb_new_auto();
+ vt->vsb = VSB_new_auto();
XXXAN(vt->vsb);
b->probe = vt;
startthread = 1;
@@ -563,7 +563,7 @@ VBP_Stop(struct backend *b, struct vrt_backend_probe const *p)
VTAILQ_REMOVE(&vbp_list, vt, list);
b->probe = NULL;
- vsb_delete(vt->vsb);
+ VSB_delete(vt->vsb);
FREE_OBJ(vt);
}
diff --git a/bin/varnishd/cache_ban.c b/bin/varnishd/cache_ban.c
index 1fa569a..bde3b5b 100644
--- a/bin/varnishd/cache_ban.c
+++ b/bin/varnishd/cache_ban.c
@@ -124,7 +124,7 @@ BAN_New(void)
ALLOC_OBJ(b, BAN_MAGIC);
if (b == NULL)
return (b);
- b->vsb = vsb_new_auto();
+ b->vsb = VSB_new_auto();
if (b->vsb == NULL) {
FREE_OBJ(b);
return (NULL);
@@ -142,7 +142,7 @@ BAN_Free(struct ban *b)
assert(VTAILQ_EMPTY(&b->objcore));
if (b->vsb != NULL)
- vsb_delete(b->vsb);
+ VSB_delete(b->vsb);
if (b->spec != NULL)
free(b->spec);
FREE_OBJ(b);
@@ -229,8 +229,8 @@ ban_add_lump(const struct ban *b, const void *p, uint32_t len)
uint8_t buf[sizeof len];
vbe32enc(buf, len);
- vsb_bcat(b->vsb, buf, sizeof buf);
- vsb_bcat(b->vsb, p, len);
+ VSB_bcat(b->vsb, buf, sizeof buf);
+ VSB_bcat(b->vsb, p, len);
}
static const void *
@@ -278,10 +278,10 @@ ban_parse_http(const struct ban *b, const char *a1)
l = strlen(a1) + 1;
assert(l <= 127);
- vsb_putc(b->vsb, (char)l);
- vsb_cat(b->vsb, a1);
- vsb_putc(b->vsb, ':');
- vsb_putc(b->vsb, '\0');
+ VSB_putc(b->vsb, (char)l);
+ VSB_cat(b->vsb, a1);
+ VSB_putc(b->vsb, ':');
+ VSB_putc(b->vsb, '\0');
}
/*--------------------------------------------------------------------
@@ -333,25 +333,25 @@ BAN_AddTest(struct cli *cli, struct ban *b, const char *a1, const char *a2,
if (pv->flag & PVAR_REQ)
b->flags |= BAN_F_REQ;
- vsb_putc(b->vsb, pv->tag);
+ VSB_putc(b->vsb, pv->tag);
if (pv->flag & PVAR_HTTP)
ban_parse_http(b, a1 + strlen(pv->name));
ban_add_lump(b, a3, strlen(a3) + 1);
if (!strcmp(a2, "~")) {
- vsb_putc(b->vsb, BAN_OPER_MATCH);
+ VSB_putc(b->vsb, BAN_OPER_MATCH);
i = ban_parse_regexp(cli, b, a3);
if (i)
return (i);
} else if (!strcmp(a2, "!~")) {
- vsb_putc(b->vsb, BAN_OPER_NMATCH);
+ VSB_putc(b->vsb, BAN_OPER_NMATCH);
i = ban_parse_regexp(cli, b, a3);
if (i)
return (i);
} else if (!strcmp(a2, "==")) {
- vsb_putc(b->vsb, BAN_OPER_EQ);
+ VSB_putc(b->vsb, BAN_OPER_EQ);
} else if (!strcmp(a2, "!=")) {
- vsb_putc(b->vsb, BAN_OPER_NEQ);
+ VSB_putc(b->vsb, BAN_OPER_NEQ);
} else {
cli_out(cli,
"expected conditional (~, !~, == or !=) got \"%s\"", a2);
@@ -378,8 +378,8 @@ BAN_Insert(struct ban *b)
CHECK_OBJ_NOTNULL(b, BAN_MAGIC);
- AZ(vsb_finish(b->vsb));
- ln = vsb_len(b->vsb);
+ AZ(VSB_finish(b->vsb));
+ ln = VSB_len(b->vsb);
assert(ln >= 0);
b->spec = malloc(ln + 13L); /* XXX */
@@ -388,11 +388,11 @@ BAN_Insert(struct ban *b)
t0 = TIM_real();
memcpy(b->spec, &t0, sizeof t0);
b->spec[12] = (b->flags & BAN_F_REQ) ? 1 : 0;
- memcpy(b->spec + 13, vsb_data(b->vsb), ln);
+ memcpy(b->spec + 13, VSB_data(b->vsb), ln);
ln += 13;
vbe32enc(b->spec + 8, ln);
- vsb_delete(b->vsb);
+ VSB_delete(b->vsb);
b->vsb = NULL;
Lck_Lock(&ban_mtx);
diff --git a/bin/varnishd/cache_center.c b/bin/varnishd/cache_center.c
index 7325f5a..9a3749f 100644
--- a/bin/varnishd/cache_center.c
+++ b/bin/varnishd/cache_center.c
@@ -730,7 +730,7 @@ cnt_fetchbody(struct sess *sp)
CHECK_OBJ_NOTNULL(sp->objcore, OBJCORE_MAGIC);
vary = VRY_Create(sp, sp->wrk->beresp);
if (vary != NULL) {
- varyl = vsb_len(vary);
+ varyl = VSB_len(vary);
assert(varyl > 0);
l += varyl;
}
@@ -773,8 +773,8 @@ cnt_fetchbody(struct sess *sp)
sp->obj->vary =
(void *)WS_Alloc(sp->obj->http->ws, varyl);
AN(sp->obj->vary);
- memcpy(sp->obj->vary, vsb_data(vary), varyl);
- vsb_delete(vary);
+ memcpy(sp->obj->vary, VSB_data(vary), varyl);
+ VSB_delete(vary);
}
sp->obj->xid = sp->xid;
diff --git a/bin/varnishd/cache_cli.c b/bin/varnishd/cache_cli.c
index 0ea5ba7..50538d7 100644
--- a/bin/varnishd/cache_cli.c
+++ b/bin/varnishd/cache_cli.c
@@ -97,7 +97,7 @@ cli_cb_after(const struct cli *cli)
ASSERT_CLI();
Lck_Unlock(&cli_mtx);
VSL(SLT_CLI, 0, "Wr %03u %u %s",
- cli->result, vsb_len(cli->sb), vsb_data(cli->sb));
+ cli->result, VSB_len(cli->sb), VSB_data(cli->sb));
}
void
diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c
index 58b3852..196cf66 100644
--- a/bin/varnishd/cache_esi_fetch.c
+++ b/bin/varnishd/cache_esi_fetch.c
@@ -367,14 +367,14 @@ vfp_esi_end(struct sess *sp)
vsb = VEP_Finish(sp);
if (vsb != NULL) {
- l = vsb_len(vsb);
+ l = VSB_len(vsb);
assert(l > 0);
/* XXX: This is a huge waste of storage... */
sp->obj->esidata = STV_alloc(sp, l);
AN(sp->obj->esidata);
- memcpy(sp->obj->esidata->ptr, vsb_data(vsb), l);
+ memcpy(sp->obj->esidata->ptr, VSB_data(vsb), l);
sp->obj->esidata->len = l;
- vsb_delete(vsb);
+ VSB_delete(vsb);
}
if (sp->wrk->vgz_rx != NULL)
VGZ_Destroy(&sp->wrk->vgz_rx);
diff --git a/bin/varnishd/cache_esi_parse.c b/bin/varnishd/cache_esi_parse.c
index 6d30619..265cb96 100644
--- a/bin/varnishd/cache_esi_parse.c
+++ b/bin/varnishd/cache_esi_parse.c
@@ -251,17 +251,17 @@ vep_emit_len(const struct vep_state *vep, ssize_t l, int m8, int m16, int m64)
buf[0] = (uint8_t)m8;
buf[1] = (uint8_t)l;
assert((ssize_t)buf[1] == l);
- vsb_bcat(vep->vsb, buf, 2);
+ VSB_bcat(vep->vsb, buf, 2);
} else if (l < 65536) {
buf[0] = (uint8_t)m16;
vbe16enc(buf + 1, (uint16_t)l);
assert((ssize_t)vbe16dec(buf + 1) == l);
- vsb_bcat(vep->vsb, buf, 3);
+ VSB_bcat(vep->vsb, buf, 3);
} else {
buf[0] = (uint8_t)m64;
vbe64enc(buf + 1, l);
assert((ssize_t)vbe64dec(buf + 1) == l);
- vsb_bcat(vep->vsb, buf, 9);
+ VSB_bcat(vep->vsb, buf, 9);
}
}
@@ -287,7 +287,7 @@ vep_emit_verbatim(const struct vep_state *vep, ssize_t l, ssize_t l_crc)
if (vep->dogzip) {
vep_emit_len(vep, l_crc, VEC_C1, VEC_C2, VEC_C8);
vbe32enc(buf, vep->crc);
- vsb_bcat(vep->vsb, buf, sizeof buf);
+ VSB_bcat(vep->vsb, buf, sizeof buf);
}
}
@@ -446,14 +446,14 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
Debug("DO_INCLUDE(%d)\n", what);
if (what == DO_ATTR) {
Debug("ATTR (%s) (%s)\n", vep->match_hit->match,
- vsb_data(vep->attr_vsb));
+ VSB_data(vep->attr_vsb));
if (vep->include_src != NULL) {
vep_error(vep,
"ESI 1.0 <esi:include> "
"has multiple src= attributes");
vep->state = VEP_TAGERROR;
- vsb_delete(vep->attr_vsb);
- vsb_delete(vep->include_src);
+ VSB_delete(vep->attr_vsb);
+ VSB_delete(vep->include_src);
vep->attr_vsb = NULL;
vep->include_src = NULL;
return;
@@ -483,22 +483,22 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
*/
assert(vep->o_wait == 0 || vep->last_mark == SKIP);
/* XXX: what if it contains NUL bytes ?? */
- p = vsb_data(vep->include_src);
- l = vsb_len(vep->include_src);
+ p = VSB_data(vep->include_src);
+ l = VSB_len(vep->include_src);
h = 0;
- vsb_printf(vep->vsb, "%c", VEC_INCL);
+ VSB_printf(vep->vsb, "%c", VEC_INCL);
if (l > 7 && !memcmp(p, "http://", 7)) {
h = p + 7;
p = strchr(h, '/');
AN(p);
Debug("HOST <%.*s> PATH <%s>\n", (int)(p-h),h, p);
- vsb_printf(vep->vsb, "Host: %.*s%c",
+ VSB_printf(vep->vsb, "Host: %.*s%c",
(int)(p-h), h, 0);
} else if (*p == '/') {
- vsb_printf(vep->vsb, "%c", 0);
+ VSB_printf(vep->vsb, "%c", 0);
} else {
- vsb_printf(vep->vsb, "%c", 0);
+ VSB_printf(vep->vsb, "%c", 0);
url = vep->sp->wrk->bereq->hd[HTTP_HDR_URL];
/* Look for the last / before a '?' */
h = NULL;
@@ -510,14 +510,14 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
Debug("INCL:: [%.*s]/[%s]\n",
(int)(h - url.b), url.b, p);
- vsb_printf(vep->vsb, "%.*s/", (int)(h - url.b), url.b);
+ VSB_printf(vep->vsb, "%.*s/", (int)(h - url.b), url.b);
}
- l -= (p - vsb_data(vep->include_src));
+ l -= (p - VSB_data(vep->include_src));
for (q = p; *q != '\0'; ) {
if (*q == '&') {
#define R(w,f,r) \
if (q + w <= p + l && !memcmp(q, f, w)) { \
- vsb_printf(vep->vsb, "%c", r); \
+ VSB_printf(vep->vsb, "%c", r); \
q += l; \
continue; \
}
@@ -527,12 +527,12 @@ vep_do_include(struct vep_state *vep, enum dowhat what)
R(4, ">", '>');
R(5, "&", '&');
}
- vsb_printf(vep->vsb, "%c", *q++);
+ VSB_printf(vep->vsb, "%c", *q++);
}
#undef R
- vsb_printf(vep->vsb, "%c", 0);
+ VSB_printf(vep->vsb, "%c", 0);
- vsb_delete(vep->include_src);
+ VSB_delete(vep->include_src);
vep->include_src = NULL;
}
@@ -846,7 +846,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
vep->state = VEP_TAGERROR;
}
} else if (vep->state == VEP_ATTRGETVAL) {
- vep->attr_vsb = vsb_new_auto();
+ vep->attr_vsb = VSB_new_auto();
vep->state = VEP_ATTRDELIM;
} else if (vep->state == VEP_ATTRDELIM) {
AZ(vep->attr_delim);
@@ -866,7 +866,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
while (p < e && *p != '>' && *p != vep->attr_delim &&
(vep->attr_delim != ' ' || !vct_issp(*p))) {
if (vep->attr_vsb != NULL)
- vsb_bcat(vep->attr_vsb, p, 1);
+ VSB_bcat(vep->attr_vsb, p, 1);
p++;
}
if (p < e && *p == '>') {
@@ -875,8 +875,8 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
vep->state = VEP_TAGERROR;
vep->attr_delim = 0;
if (vep->attr_vsb != NULL) {
- AZ(vsb_finish(vep->attr_vsb));
- vsb_delete(vep->attr_vsb);
+ AZ(VSB_finish(vep->attr_vsb));
+ VSB_delete(vep->attr_vsb);
vep->attr_vsb = NULL;
}
} else if (p < e) {
@@ -884,7 +884,7 @@ VEP_parse(const struct sess *sp, const char *p, size_t l)
p++;
vep->state = VEP_INTAG;
if (vep->attr_vsb != NULL) {
- AZ(vsb_finish(vep->attr_vsb));
+ AZ(VSB_finish(vep->attr_vsb));
AN(vep->dostuff);
vep->dostuff(vep, DO_ATTR);
vep->attr_vsb = NULL;
@@ -1005,13 +1005,13 @@ VEP_Init(const struct sess *sp, vep_callback_t *cb)
memset(vep, 0, sizeof *vep);
vep->magic = VEP_MAGIC;
vep->sp = sp;
- vep->vsb = vsb_new_auto();
+ vep->vsb = VSB_new_auto();
AN(vep->vsb);
if (cb != NULL) {
vep->dogzip = 1;
/* XXX */
- vsb_printf(vep->vsb, "%c", VEC_GZ);
+ VSB_printf(vep->vsb, "%c", VEC_GZ);
vep->cb = cb;
} else {
vep->cb = vep_default_cb;
@@ -1056,11 +1056,11 @@ VEP_Finish(const struct sess *sp)
sp->wrk->vep = NULL;
- AZ(vsb_finish(vep->vsb));
- l = vsb_len(vep->vsb);
+ AZ(VSB_finish(vep->vsb));
+ l = VSB_len(vep->vsb);
if (vep->esi_found && l > 0)
return (vep->vsb);
- vsb_delete(vep->vsb);
+ VSB_delete(vep->vsb);
return (NULL);
}
diff --git a/bin/varnishd/cache_hash.c b/bin/varnishd/cache_hash.c
index 14e3841..0b58581 100644
--- a/bin/varnishd/cache_hash.c
+++ b/bin/varnishd/cache_hash.c
@@ -752,7 +752,7 @@ HSH_config(const char *h_arg)
hp = pick(hsh_choice, av[1], "hash");
CHECK_OBJ_NOTNULL(hp, SLINGER_MAGIC);
- vsb_printf(vident, ",-h%s", av[1]);
+ VSB_printf(vident, ",-h%s", av[1]);
heritage.hash = hp;
if (hp->init != NULL)
hp->init(ac, av + 2);
diff --git a/bin/varnishd/cache_panic.c b/bin/varnishd/cache_panic.c
index 08cff86..66e13c0 100644
--- a/bin/varnishd/cache_panic.c
+++ b/bin/varnishd/cache_panic.c
@@ -63,24 +63,24 @@ static void
pan_ws(const struct ws *ws, int indent)
{
- vsb_printf(vsp, "%*sws = %p { %s\n", indent, "",
+ VSB_printf(vsp, "%*sws = %p { %s\n", indent, "",
ws, ws->overflow ? "overflow" : "");
- vsb_printf(vsp, "%*sid = \"%s\",\n", indent + 2, "", ws->id);
- vsb_printf(vsp, "%*s{s,f,r,e} = {%p", indent + 2, "", ws->s);
+ VSB_printf(vsp, "%*sid = \"%s\",\n", indent + 2, "", ws->id);
+ VSB_printf(vsp, "%*s{s,f,r,e} = {%p", indent + 2, "", ws->s);
if (ws->f > ws->s)
- vsb_printf(vsp, ",+%ld", (long) (ws->f - ws->s));
+ VSB_printf(vsp, ",+%ld", (long) (ws->f - ws->s));
else
- vsb_printf(vsp, ",%p", ws->f);
+ VSB_printf(vsp, ",%p", ws->f);
if (ws->r > ws->s)
- vsb_printf(vsp, ",+%ld", (long) (ws->r - ws->s));
+ VSB_printf(vsp, ",+%ld", (long) (ws->r - ws->s));
else
- vsb_printf(vsp, ",%p", ws->r);
+ VSB_printf(vsp, ",%p", ws->r);
if (ws->e > ws->s)
- vsb_printf(vsp, ",+%ld", (long) (ws->e - ws->s));
+ VSB_printf(vsp, ",+%ld", (long) (ws->e - ws->s));
else
- vsb_printf(vsp, ",%p", ws->e);
- vsb_printf(vsp, "},\n");
- vsb_printf(vsp, "%*s},\n", indent, "" );
+ VSB_printf(vsp, ",%p", ws->e);
+ VSB_printf(vsp, "},\n");
+ VSB_printf(vsp, "%*s},\n", indent, "" );
}
/*--------------------------------------------------------------------*/
@@ -93,9 +93,9 @@ pan_vbc(const struct vbc *vbc)
be = vbc->backend;
- vsb_printf(vsp, " backend = %p fd = %d {\n", be, vbc->fd);
- vsb_printf(vsp, " vcl_name = \"%s\",\n", be->vcl_name);
- vsb_printf(vsp, " },\n");
+ VSB_printf(vsp, " backend = %p fd = %d {\n", be, vbc->fd);
+ VSB_printf(vsp, " vcl_name = \"%s\",\n", be->vcl_name);
+ VSB_printf(vsp, " },\n");
}
/*--------------------------------------------------------------------*/
@@ -108,24 +108,24 @@ pan_storage(const struct storage *st)
#define MAX_BYTES (4*16)
#define show(ch) (((ch) > 31 && (ch) < 127) ? (ch) : '.')
- vsb_printf(vsp, " %u {\n", st->len);
+ VSB_printf(vsp, " %u {\n", st->len);
for (i = 0; i < MAX_BYTES && i < st->len; i += 16) {
- vsb_printf(vsp, " ");
+ VSB_printf(vsp, " ");
for (j = 0; j < 16; ++j) {
if (i + j < st->len)
- vsb_printf(vsp, "%02x ", st->ptr[i + j]);
+ VSB_printf(vsp, "%02x ", st->ptr[i + j]);
else
- vsb_printf(vsp, " ");
+ VSB_printf(vsp, " ");
}
- vsb_printf(vsp, "|");
+ VSB_printf(vsp, "|");
for (j = 0; j < 16; ++j)
if (i + j < st->len)
- vsb_printf(vsp, "%c", show(st->ptr[i + j]));
- vsb_printf(vsp, "|\n");
+ VSB_printf(vsp, "%c", show(st->ptr[i + j]));
+ VSB_printf(vsp, "|\n");
}
if (st->len > MAX_BYTES)
- vsb_printf(vsp, " [%u more]\n", st->len - MAX_BYTES);
- vsb_printf(vsp, " },\n");
+ VSB_printf(vsp, " [%u more]\n", st->len - MAX_BYTES);
+ VSB_printf(vsp, " },\n");
#undef show
#undef MAX_BYTES
@@ -138,17 +138,17 @@ pan_http(const char *id, const struct http *h, int indent)
{
int i;
- vsb_printf(vsp, "%*shttp[%s] = {\n", indent, "", id);
- vsb_printf(vsp, "%*sws = %p[%s]\n", indent + 2, "",
+ VSB_printf(vsp, "%*shttp[%s] = {\n", indent, "", id);
+ VSB_printf(vsp, "%*sws = %p[%s]\n", indent + 2, "",
h->ws, h->ws ? h->ws->id : "");
for (i = 0; i < h->nhd; ++i) {
if (h->hd[i].b == NULL && h->hd[i].e == NULL)
continue;
- vsb_printf(vsp, "%*s\"%.*s\",\n", indent + 4, "",
+ VSB_printf(vsp, "%*s\"%.*s\",\n", indent + 4, "",
(int)(h->hd[i].e - h->hd[i].b),
h->hd[i].b);
}
- vsb_printf(vsp, "%*s},\n", indent, "");
+ VSB_printf(vsp, "%*s},\n", indent, "");
}
@@ -159,16 +159,16 @@ pan_object(const struct object *o)
{
const struct storage *st;
- vsb_printf(vsp, " obj = %p {\n", o);
- vsb_printf(vsp, " xid = %u,\n", o->xid);
+ VSB_printf(vsp, " obj = %p {\n", o);
+ VSB_printf(vsp, " xid = %u,\n", o->xid);
pan_ws(o->ws_o, 4);
pan_http("obj", o->http, 4);
- vsb_printf(vsp, " len = %jd,\n", (intmax_t)o->len);
- vsb_printf(vsp, " store = {\n");
+ VSB_printf(vsp, " len = %jd,\n", (intmax_t)o->len);
+ VSB_printf(vsp, " store = {\n");
VTAILQ_FOREACH(st, &o->store, list)
pan_storage(st);
- vsb_printf(vsp, " },\n");
- vsb_printf(vsp, " },\n");
+ VSB_printf(vsp, " },\n");
+ VSB_printf(vsp, " },\n");
}
/*--------------------------------------------------------------------*/
@@ -178,12 +178,12 @@ pan_vcl(const struct VCL_conf *vcl)
{
int i;
- vsb_printf(vsp, " vcl = {\n");
- vsb_printf(vsp, " srcname = {\n");
+ VSB_printf(vsp, " vcl = {\n");
+ VSB_printf(vsp, " srcname = {\n");
for (i = 0; i < vcl->nsrc; ++i)
- vsb_printf(vsp, " \"%s\",\n", vcl->srcname[i]);
- vsb_printf(vsp, " },\n");
- vsb_printf(vsp, " },\n");
+ VSB_printf(vsp, " \"%s\",\n", vcl->srcname[i]);
+ VSB_printf(vsp, " },\n");
+ VSB_printf(vsp, " },\n");
}
@@ -193,7 +193,7 @@ static void
pan_wrk(const struct worker *wrk)
{
- vsb_printf(vsp, " worker = %p {\n", wrk);
+ VSB_printf(vsp, " worker = %p {\n", wrk);
pan_ws(wrk->ws, 4);
if (wrk->bereq->ws != NULL)
pan_http("bereq", wrk->bereq, 4);
@@ -201,7 +201,7 @@ pan_wrk(const struct worker *wrk)
pan_http("beresp", wrk->beresp, 4);
if (wrk->resp->ws != NULL)
pan_http("resp", wrk->resp, 4);
- vsb_printf(vsp, " },\n");
+ VSB_printf(vsp, " },\n");
}
/*--------------------------------------------------------------------*/
@@ -211,10 +211,10 @@ pan_sess(const struct sess *sp)
{
const char *stp, *hand;
- vsb_printf(vsp, "sp = %p {\n", sp);
- vsb_printf(vsp,
+ VSB_printf(vsp, "sp = %p {\n", sp);
+ VSB_printf(vsp,
" fd = %d, id = %d, xid = %u,\n", sp->fd, sp->id, sp->xid);
- vsb_printf(vsp, " client = %s %s,\n",
+ VSB_printf(vsp, " client = %s %s,\n",
sp->addr ? sp->addr : "?.?.?.?",
sp->port ? sp->port : "?");
switch (sp->step) {
@@ -225,19 +225,19 @@ pan_sess(const struct sess *sp)
}
hand = VCC_Return_Name(sp->handling);
if (stp != NULL)
- vsb_printf(vsp, " step = %s,\n", stp);
+ VSB_printf(vsp, " step = %s,\n", stp);
else
- vsb_printf(vsp, " step = 0x%x,\n", sp->step);
+ VSB_printf(vsp, " step = 0x%x,\n", sp->step);
if (hand != NULL)
- vsb_printf(vsp, " handling = %s,\n", hand);
+ VSB_printf(vsp, " handling = %s,\n", hand);
else
- vsb_printf(vsp, " handling = 0x%x,\n", sp->handling);
+ VSB_printf(vsp, " handling = 0x%x,\n", sp->handling);
if (sp->err_code)
- vsb_printf(vsp,
+ VSB_printf(vsp,
" err_code = %d, err_reason = %s,\n", sp->err_code,
sp->err_reason ? sp->err_reason : "(null)");
- vsb_printf(vsp, " restarts = %d, esi_level = %d\n",
+ VSB_printf(vsp, " restarts = %d, esi_level = %d\n",
sp->restarts, sp->esi_level);
pan_ws(sp->ws, 2);
@@ -255,7 +255,7 @@ pan_sess(const struct sess *sp)
if (VALID_OBJ(sp->obj, OBJECT_MAGIC))
pan_object(sp->obj);
- vsb_printf(vsp, "},\n");
+ VSB_printf(vsp, "},\n");
}
/*--------------------------------------------------------------------*/
@@ -270,18 +270,18 @@ pan_backtrace(void)
size = backtrace (array, 10);
if (size == 0)
return;
- vsb_printf(vsp, "Backtrace:\n");
+ VSB_printf(vsp, "Backtrace:\n");
for (i = 0; i < size; i++) {
- vsb_printf (vsp, " ");
+ VSB_printf (vsp, " ");
if (Symbol_Lookup(vsp, array[i]) < 0) {
char **strings;
strings = backtrace_symbols(&array[i], 1);
if (strings != NULL && strings[0] != NULL)
- vsb_printf(vsp, "%p: %s", array[i], strings[0]);
+ VSB_printf(vsp, "%p: %s", array[i], strings[0]);
else
- vsb_printf(vsp, "%p: (?)", array[i]);
+ VSB_printf(vsp, "%p: (?)", array[i]);
}
- vsb_printf (vsp, "\n");
+ VSB_printf (vsp, "\n");
}
}
@@ -296,36 +296,36 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
switch(xxx) {
case 3:
- vsb_printf(vsp,
+ VSB_printf(vsp,
"Wrong turn at %s:%d:\n%s\n", file, line, cond);
break;
case 2:
- vsb_printf(vsp,
+ VSB_printf(vsp,
"Panic from VCL:\n %s\n", cond);
break;
case 1:
- vsb_printf(vsp,
+ VSB_printf(vsp,
"Missing errorhandling code in %s(), %s line %d:\n"
" Condition(%s) not true.",
func, file, line, cond);
break;
default:
case 0:
- vsb_printf(vsp,
+ VSB_printf(vsp,
"Assert error in %s(), %s line %d:\n"
" Condition(%s) not true.\n",
func, file, line, cond);
break;
}
if (err)
- vsb_printf(vsp, "errno = %d (%s)\n", err, strerror(err));
+ VSB_printf(vsp, "errno = %d (%s)\n", err, strerror(err));
q = THR_GetName();
if (q != NULL)
- vsb_printf(vsp, "thread = (%s)\n", q);
+ VSB_printf(vsp, "thread = (%s)\n", q);
- vsb_printf(vsp, "ident = %s,%s\n",
- vsb_data(vident) + 1, VCA_waiter_name());
+ VSB_printf(vsp, "ident = %s,%s\n",
+ VSB_data(vident) + 1, VCA_waiter_name());
pan_backtrace();
@@ -334,8 +334,8 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
if (sp != NULL)
pan_sess(sp);
}
- vsb_printf(vsp, "\n");
- vsb_bcat(vsp, "", 1); /* NUL termination */
+ VSB_printf(vsp, "\n");
+ VSB_bcat(vsp, "", 1); /* NUL termination */
if (params->diag_bitmap & 0x4000)
(void)fputs(vsm_head->panicstr, stderr);
@@ -366,6 +366,6 @@ PAN_Init(void)
vas_fail = pan_ic;
vsp = &vsps;
- AN(vsb_new(vsp, vsm_head->panicstr, sizeof vsm_head->panicstr,
+ AN(VSB_new(vsp, vsm_head->panicstr, sizeof vsm_head->panicstr,
VSB_FIXEDLEN));
}
diff --git a/bin/varnishd/cache_vary.c b/bin/varnishd/cache_vary.c
index 28ee29f..034175b 100644
--- a/bin/varnishd/cache_vary.c
+++ b/bin/varnishd/cache_vary.c
@@ -72,11 +72,11 @@ VRY_Create(const struct sess *sp, const struct http *hp)
return (NULL);
/* For vary matching string */
- sb = vsb_new_auto();
+ sb = VSB_new_auto();
AN(sb);
/* For header matching strings */
- sbh = vsb_new_auto();
+ sbh = VSB_new_auto();
AN(sbh);
if (*v == ':') {
@@ -92,15 +92,15 @@ VRY_Create(const struct sess *sp, const struct http *hp)
continue;
/* Build a header-matching string out of it */
- vsb_clear(sbh);
- vsb_printf(sbh, "%c%.*s:%c",
+ VSB_clear(sbh);
+ VSB_printf(sbh, "%c%.*s:%c",
(char)(1 + (q - p)), (int)(q - p), p, 0);
- AZ(vsb_finish(sbh));
+ AZ(VSB_finish(sbh));
/* Append to vary matching string */
- vsb_bcat(sb, vsb_data(sbh), vsb_len(sbh));
+ VSB_bcat(sb, VSB_data(sbh), VSB_len(sbh));
- if (http_GetHdr(sp->http, vsb_data(sbh), &h)) {
+ if (http_GetHdr(sp->http, VSB_data(sbh), &h)) {
/* Trim leading and trailing space */
while (isspace(*h))
h++;
@@ -110,11 +110,11 @@ VRY_Create(const struct sess *sp, const struct http *hp)
/* Encode two byte length and contents */
l = e - h;
assert(!(l & ~0xffff));
- vsb_printf(sb, "%c%c", (unsigned)l >> 8, l & 0xff);
- vsb_bcat(sb, h, e - h);
+ VSB_printf(sb, "%c%c", (unsigned)l >> 8, l & 0xff);
+ VSB_bcat(sb, h, e - h);
} else {
/* Mark as "not present" */
- vsb_printf(sb, "%c%c", 0xff, 0xff);
+ VSB_printf(sb, "%c%c", 0xff, 0xff);
}
while (isspace(*q))
@@ -125,10 +125,10 @@ VRY_Create(const struct sess *sp, const struct http *hp)
p = q;
}
/* Terminate vary matching string */
- vsb_printf(sb, "%c", 0);
+ VSB_printf(sb, "%c", 0);
- vsb_delete(sbh);
- AZ(vsb_finish(sb));
+ VSB_delete(sbh);
+ AZ(VSB_finish(sb));
return(sb);
}
diff --git a/bin/varnishd/cache_vrt.c b/bin/varnishd/cache_vrt.c
index d66c66c..19aa575 100644
--- a/bin/varnishd/cache_vrt.c
+++ b/bin/varnishd/cache_vrt.c
@@ -404,13 +404,13 @@ VRT_synth_page(const struct sess *sp, unsigned flags, const char *str, ...)
vsb = SMS_Makesynth(sp->obj);
AN(vsb);
- vsb_cat(vsb, str);
+ VSB_cat(vsb, str);
va_start(ap, str);
p = va_arg(ap, const char *);
while (p != vrt_magic_string_end) {
if (p == NULL)
p = "(null)";
- vsb_cat(vsb, p);
+ VSB_cat(vsb, p);
p = va_arg(ap, const char *);
}
va_end(ap);
diff --git a/bin/varnishd/mgt_child.c b/bin/varnishd/mgt_child.c
index 3ed569d..4258af2 100644
--- a/bin/varnishd/mgt_child.c
+++ b/bin/varnishd/mgt_child.c
@@ -438,19 +438,19 @@ mgt_save_panic(void)
return;
if (child_panic)
- vsb_delete(child_panic);
- child_panic = vsb_new_auto();
+ VSB_delete(child_panic);
+ child_panic = VSB_new_auto();
XXXAN(child_panic);
TIM_format(TIM_real(), time_str);
- vsb_printf(child_panic, "Last panic at: %s\n", time_str);
- vsb_cat(child_panic, vsm_head->panicstr);
- AZ(vsb_finish(child_panic));
+ VSB_printf(child_panic, "Last panic at: %s\n", time_str);
+ VSB_cat(child_panic, vsm_head->panicstr);
+ AZ(VSB_finish(child_panic));
}
static void
mgt_clear_panic(void)
{
- vsb_delete(child_panic);
+ VSB_delete(child_panic);
child_panic = NULL;
}
@@ -476,26 +476,26 @@ mgt_sigchld(const struct vev *e, int what)
if (r == 0 || (r == -1 && errno == ECHILD))
return (0);
assert(r == child_pid);
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
XXXAN(vsb);
- vsb_printf(vsb, "Child (%d) %s", r, status ? "died" : "ended");
+ VSB_printf(vsb, "Child (%d) %s", r, status ? "died" : "ended");
if (!WIFEXITED(status) && WEXITSTATUS(status)) {
- vsb_printf(vsb, " status=%d", WEXITSTATUS(status));
+ VSB_printf(vsb, " status=%d", WEXITSTATUS(status));
exit_status |= 0x20;
}
if (WIFSIGNALED(status)) {
- vsb_printf(vsb, " signal=%d", WTERMSIG(status));
+ VSB_printf(vsb, " signal=%d", WTERMSIG(status));
exit_status |= 0x40;
}
#ifdef WCOREDUMP
if (WCOREDUMP(status)) {
- vsb_printf(vsb, " (core dumped)");
+ VSB_printf(vsb, " (core dumped)");
exit_status |= 0x80;
}
#endif
- AZ(vsb_finish(vsb));
- REPORT(LOG_INFO, "%s", vsb_data(vsb));
- vsb_delete(vsb);
+ AZ(VSB_finish(vsb));
+ REPORT(LOG_INFO, "%s", VSB_data(vsb));
+ VSB_delete(vsb);
mgt_report_panic(r);
mgt_save_panic();
@@ -650,7 +650,7 @@ mcf_panic_show(struct cli *cli, const char * const *av, void *priv)
return;
}
- cli_out(cli, "%s\n", vsb_data(child_panic));
+ cli_out(cli, "%s\n", VSB_data(child_panic));
}
void
diff --git a/bin/varnishd/mgt_cli.c b/bin/varnishd/mgt_cli.c
index 66ee1b4..d5c7fe0 100644
--- a/bin/varnishd/mgt_cli.c
+++ b/bin/varnishd/mgt_cli.c
@@ -79,7 +79,7 @@ mcf_banner(struct cli *cli, const char *const *av, void *priv)
cli_out(cli, "-----------------------------\n");
cli_out(cli, "Varnish Cache CLI 1.0\n");
cli_out(cli, "-----------------------------\n");
- cli_out(cli, "%s\n", vsb_data(vident) + 1);
+ cli_out(cli, "%s\n", VSB_data(vident) + 1);
cli_out(cli, "\n");
cli_out(cli, "Type 'help' for command list.\n");
cli_out(cli, "Type 'quit' to close CLI session.\n");
@@ -155,22 +155,22 @@ mcf_askchild(struct cli *cli, const char * const *av, void *priv)
"Type 'help' for more info.");
return;
}
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
for (i = 1; av[i] != NULL; i++) {
- vsb_quote(vsb, av[i], strlen(av[i]), 0);
- vsb_putc(vsb, ' ');
+ VSB_quote(vsb, av[i], strlen(av[i]), 0);
+ VSB_putc(vsb, ' ');
}
- vsb_putc(vsb, '\n');
- AZ(vsb_finish(vsb));
- i = write(cli_o, vsb_data(vsb), vsb_len(vsb));
- if (i != vsb_len(vsb)) {
- vsb_delete(vsb);
+ VSB_putc(vsb, '\n');
+ AZ(VSB_finish(vsb));
+ i = write(cli_o, VSB_data(vsb), VSB_len(vsb));
+ if (i != VSB_len(vsb)) {
+ VSB_delete(vsb);
cli_result(cli, CLIS_COMMS);
cli_out(cli, "CLI communication error");
MGT_Child_Cli_Fail();
return;
}
- vsb_delete(vsb);
+ VSB_delete(vsb);
(void)cli_readres(cli_i, &u, &q, params->cli_timeout);
cli_result(cli, u);
cli_out(cli, "%s", q);
@@ -327,7 +327,7 @@ mgt_cli_cb_after(const struct cli *cli)
if (params->syslog_cli_traffic)
syslog(LOG_NOTICE, "CLI %s Wr %03u %s",
- cli->ident, cli->result, vsb_data(cli->sb));
+ cli->ident, cli->result, VSB_data(cli->sb));
}
/*--------------------------------------------------------------------*/
@@ -399,7 +399,7 @@ mgt_cli_setup(int fdi, int fdo, int verbose, const char *ident, mgt_cli_close_f
cli->auth = MCF_AUTH;
mcf_banner(cli, NULL, NULL);
}
- AZ(vsb_finish(cli->sb));
+ AZ(VSB_finish(cli->sb));
(void)cli_writeres(fdo, cli);
@@ -423,12 +423,12 @@ sock_id(const char *pfx, int fd)
char abuf1[TCP_ADDRBUFSIZE], abuf2[TCP_ADDRBUFSIZE];
char pbuf1[TCP_PORTBUFSIZE], pbuf2[TCP_PORTBUFSIZE];
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
TCP_myname(fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1);
TCP_hisname(fd, abuf2, sizeof abuf2, pbuf2, sizeof pbuf2);
- vsb_printf(vsb, "%s %s %s %s %s", pfx, abuf2, pbuf2, abuf1, pbuf1);
- AZ(vsb_finish(vsb));
+ VSB_printf(vsb, "%s %s %s %s %s", pfx, abuf2, pbuf2, abuf1, pbuf1);
+ AZ(VSB_finish(vsb));
return (vsb);
}
@@ -482,8 +482,8 @@ telnet_accept(const struct vev *ev, int what)
mgt_got_fd(i);
tn = telnet_new(i);
vsb = sock_id("telnet", i);
- mgt_cli_setup(i, i, 0, vsb_data(vsb), telnet_close, tn);
- vsb_delete(vsb);
+ mgt_cli_setup(i, i, 0, VSB_data(vsb), telnet_close, tn);
+ VSB_delete(vsb);
return (0);
}
@@ -537,14 +537,14 @@ mgt_cli_telnet(const char *T_arg)
exit(2);
}
good = 0;
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
XXXAN(vsb);
for (i = 0; i < n; ++i) {
sock = VSS_listen(ta[i], 10);
if (sock < 0)
continue;
TCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf);
- vsb_printf(vsb, "%s %s\n", abuf, pbuf);
+ VSB_printf(vsb, "%s %s\n", abuf, pbuf);
good++;
tn = telnet_new(sock);
tn->ev = vev_new();
@@ -561,12 +561,12 @@ mgt_cli_telnet(const char *T_arg)
REPORT(LOG_ERR, "-T %s could not be listened on.", T_arg);
exit(2);
}
- AZ(vsb_finish(vsb));
+ AZ(VSB_finish(vsb));
/* Save in shmem */
- p = VSM_Alloc(vsb_len(vsb) + 1, "Arg", "-T", "");
+ p = VSM_Alloc(VSB_len(vsb) + 1, "Arg", "-T", "");
AN(p);
- strcpy(p, vsb_data(vsb));
- vsb_delete(vsb);
+ strcpy(p, VSB_data(vsb));
+ VSB_delete(vsb);
}
/* Reverse CLI ("Master") connections --------------------------------*/
@@ -613,8 +613,8 @@ Marg_poker(const struct vev *e, int what)
return (1);
}
vsb = sock_id("master", M_fd);
- mgt_cli_setup(M_fd, M_fd, 0, vsb_data(vsb), Marg_closer, NULL);
- vsb_delete(vsb);
+ mgt_cli_setup(M_fd, M_fd, 0, VSB_data(vsb), Marg_closer, NULL);
+ VSB_delete(vsb);
M_poll = 1;
return (1);
}
diff --git a/bin/varnishd/mgt_vcc.c b/bin/varnishd/mgt_vcc.c
index a3028ad..2e1c9a5 100644
--- a/bin/varnishd/mgt_vcc.c
+++ b/bin/varnishd/mgt_vcc.c
@@ -86,35 +86,35 @@ mgt_make_cc_cmd(const char *sf, const char *of)
int pct;
char *p;
- sb = vsb_new_auto();
+ sb = VSB_new_auto();
XXXAN(sb);
for (p = mgt_cc_cmd, pct = 0; *p; ++p) {
if (pct) {
switch (*p) {
case 's':
- vsb_cat(sb, sf);
+ VSB_cat(sb, sf);
break;
case 'o':
- vsb_cat(sb, of);
+ VSB_cat(sb, of);
break;
case '%':
- vsb_putc(sb, '%');
+ VSB_putc(sb, '%');
break;
default:
- vsb_putc(sb, '%');
- vsb_putc(sb, *p);
+ VSB_putc(sb, '%');
+ VSB_putc(sb, *p);
break;
}
pct = 0;
} else if (*p == '%') {
pct = 1;
} else {
- vsb_putc(sb, *p);
+ VSB_putc(sb, *p);
}
}
if (pct)
- vsb_putc(sb, '%');
- AZ(vsb_finish(sb));
+ VSB_putc(sb, '%');
+ AZ(VSB_finish(sb));
return (sb);
}
@@ -138,16 +138,16 @@ run_vcc(void *priv)
int fd, i, l;
CAST_OBJ_NOTNULL(vp, priv, VCC_PRIV_MAGIC);
- sb = vsb_new_auto();
+ sb = VSB_new_auto();
XXXAN(sb);
VCC_VCL_dir(vcc, mgt_vcl_dir);
VCC_VMOD_dir(vcc, mgt_vmod_dir);
VCC_Err_Unref(vcc, mgt_vcc_err_unref);
csrc = VCC_Compile(vcc, sb, vp->vcl);
- AZ(vsb_finish(sb));
- if (vsb_len(sb))
- printf("%s", vsb_data(sb));
- vsb_delete(sb);
+ AZ(VSB_finish(sb));
+ if (VSB_len(sb))
+ printf("%s", VSB_data(sb));
+ VSB_delete(sb);
if (csrc == NULL)
exit (1);
@@ -236,7 +236,7 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag)
/* Create temporary C source file */
sfd = vtmpfile(sf);
if (sfd < 0) {
- vsb_printf(sb, "Failed to create %s: %s", sf, strerror(errno));
+ VSB_printf(sb, "Failed to create %s: %s", sf, strerror(errno));
return (NULL);
}
AZ(close(sfd));
@@ -269,10 +269,10 @@ mgt_run_cc(const char *vcl, struct vsb *sb, int C_flag)
cmdsb = mgt_make_cc_cmd(sf, of);
/* Run the C-compiler in a sub-shell */
- i = SUB_run(sb, run_cc, vsb_data(cmdsb), "C-compiler", 10);
+ i = SUB_run(sb, run_cc, VSB_data(cmdsb), "C-compiler", 10);
(void)unlink(sf);
- vsb_delete(cmdsb);
+ VSB_delete(cmdsb);
if (!i)
i = SUB_run(sb, run_dlopen, of, "dlopen", 10);
@@ -294,10 +294,10 @@ mgt_VccCompile(struct vsb **sb, const char *b, int C_flag)
{
char *vf;
- *sb = vsb_new_auto();
+ *sb = VSB_new_auto();
XXXAN(*sb);
vf = mgt_run_cc(b, *sb, C_flag);
- AZ(vsb_finish(*sb));
+ AZ(VSB_finish(*sb));
return (vf);
}
@@ -387,9 +387,9 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, char *vcl, int C_flag)
vf = mgt_VccCompile(&sb, vcl, C_flag);
free(vcl);
- if (vsb_len(sb) > 0)
- fprintf(stderr, "%s", vsb_data(sb));
- vsb_delete(sb);
+ if (VSB_len(sb) > 0)
+ fprintf(stderr, "%s", VSB_data(sb));
+ VSB_delete(sb);
if (C_flag) {
if (vf != NULL)
AZ(unlink(vf));
@@ -488,9 +488,9 @@ mcf_config_inline(struct cli *cli, const char * const *av, void *priv)
}
vf = mgt_VccCompile(&sb, av[3], 0);
- if (vsb_len(sb) > 0)
- cli_out(cli, "%s\n", vsb_data(sb));
- vsb_delete(sb);
+ if (VSB_len(sb) > 0)
+ cli_out(cli, "%s\n", VSB_data(sb));
+ VSB_delete(sb);
if (vf == NULL) {
cli_out(cli, "VCL compilation failed");
cli_result(cli, CLIS_PARAM);
@@ -534,9 +534,9 @@ mcf_config_load(struct cli *cli, const char * const *av, void *priv)
vf = mgt_VccCompile(&sb, vcl, 0);
free(vcl);
- if (vsb_len(sb) > 0)
- cli_out(cli, "%s", vsb_data(sb));
- vsb_delete(sb);
+ if (VSB_len(sb) > 0)
+ cli_out(cli, "%s", VSB_data(sb));
+ VSB_delete(sb);
if (vf == NULL) {
cli_out(cli, "VCL compilation failed");
cli_result(cli, CLIS_PARAM);
diff --git a/bin/varnishd/stevedore.c b/bin/varnishd/stevedore.c
index 51f4422..dfde531 100644
--- a/bin/varnishd/stevedore.c
+++ b/bin/varnishd/stevedore.c
@@ -458,7 +458,7 @@ STV_Config(const char *spec)
AN(stv2);
/* Append strategy to ident string */
- vsb_printf(vident, ",-s%s", av[1]);
+ VSB_printf(vident, ",-s%s", av[1]);
av += 2;
diff --git a/bin/varnishd/storage_synth.c b/bin/varnishd/storage_synth.c
index f21158c..6894e99 100644
--- a/bin/varnishd/storage_synth.c
+++ b/bin/varnishd/storage_synth.c
@@ -52,7 +52,7 @@ sms_free(struct storage *sto)
VSC_main->sms_nbytes -= sto->len;
VSC_main->sms_bfree += sto->len;
Lck_Unlock(&sms_mtx);
- vsb_delete(sto->priv);
+ VSB_delete(sto->priv);
free(sto);
}
@@ -86,7 +86,7 @@ SMS_Makesynth(struct object *obj)
sto = calloc(sizeof *sto, 1);
XXXAN(sto);
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
XXXAN(vsb);
sto->priv = vsb;
sto->len = 0;
@@ -111,11 +111,11 @@ SMS_Finish(struct object *obj)
sto = VTAILQ_FIRST(&obj->store);
assert(sto->stevedore == &sms_stevedore);
vsb = sto->priv;
- AZ(vsb_finish(vsb));
+ AZ(VSB_finish(vsb));
- sto->ptr = (void*)vsb_data(vsb);
- sto->len = vsb_len(vsb);
- sto->space = vsb_len(vsb);
+ sto->ptr = (void*)VSB_data(vsb);
+ sto->len = VSB_len(vsb);
+ sto->space = VSB_len(vsb);
obj->len = sto->len;
Lck_Lock(&sms_mtx);
VSC_main->sms_nbytes += sto->len;
diff --git a/bin/varnishd/varnishd.c b/bin/varnishd/varnishd.c
index b36f28c..74f8f3c 100644
--- a/bin/varnishd/varnishd.c
+++ b/bin/varnishd/varnishd.c
@@ -83,12 +83,12 @@ build_vident(void)
{
struct utsname uts;
- vident = vsb_new_auto();
+ vident = VSB_new_auto();
AN(vident);
if (!uname(&uts)) {
- vsb_printf(vident, ",%s", uts.sysname);
- vsb_printf(vident, ",%s", uts.release);
- vsb_printf(vident, ",%s", uts.machine);
+ VSB_printf(vident, ",%s", uts.sysname);
+ VSB_printf(vident, ",%s", uts.release);
+ VSB_printf(vident, ",%s", uts.machine);
}
}
@@ -219,11 +219,11 @@ static void
cli_check(const struct cli *cli)
{
if (cli->result == CLIS_OK) {
- vsb_clear(cli->sb);
+ VSB_clear(cli->sb);
return;
}
- AZ(vsb_finish(cli->sb));
- fprintf(stderr, "Error:\n%s\n", vsb_data(cli->sb));
+ AZ(VSB_finish(cli->sb));
+ fprintf(stderr, "Error:\n%s\n", VSB_data(cli->sb));
exit (2);
}
@@ -262,7 +262,7 @@ Symbol_Lookup(struct vsb *vsb, void *ptr)
}
if (s0 == NULL)
return (-1);
- vsb_printf(vsb, "%p: %s+%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
+ VSB_printf(vsb, "%p: %s+%jx", ptr, s0->n, (uintmax_t)pp - s0->a);
return (0);
}
@@ -394,7 +394,7 @@ main(int argc, char * const *argv)
SHA256_Test();
memset(cli, 0, sizeof cli);
- cli[0].sb = vsb_new_auto();
+ cli[0].sb = VSB_new_auto();
XXXAN(cli[0].sb);
cli[0].result = CLIS_OK;
@@ -526,8 +526,8 @@ main(int argc, char * const *argv)
/* XXX: we can have multiple CLI actions above, is this enough ? */
if (cli[0].result != CLIS_OK) {
fprintf(stderr, "Parameter errors:\n");
- AZ(vsb_finish(cli[0].sb));
- fprintf(stderr, "%s\n", vsb_data(cli[0].sb));
+ AZ(VSB_finish(cli[0].sb));
+ fprintf(stderr, "%s\n", VSB_data(cli[0].sb));
exit(1);
}
@@ -613,7 +613,7 @@ main(int argc, char * const *argv)
mgt_SHM_Init(l_arg);
- AZ(vsb_finish(vident));
+ AZ(VSB_finish(vident));
if (!d_flag && !F_flag)
AZ(varnish_daemon(1, 0));
@@ -624,8 +624,8 @@ main(int argc, char * const *argv)
fprintf(stderr, "NOTE: Could not write PID file\n");
if (d_flag)
- fprintf(stderr, "Platform: %s\n", vsb_data(vident) + 1);
- syslog(LOG_NOTICE, "Platform: %s\n", vsb_data(vident) + 1);
+ fprintf(stderr, "Platform: %s\n", VSB_data(vident) + 1);
+ syslog(LOG_NOTICE, "Platform: %s\n", VSB_data(vident) + 1);
/* Do this again after debugstunt and daemon has run */
mgt_pid = getpid();
diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c
index c6373f6..ddfff39 100644
--- a/bin/varnishlog/varnishlog.c
+++ b/bin/varnishlog/varnishlog.c
@@ -63,12 +63,12 @@ static void
h_order_finish(int fd, struct VSM_data *vd)
{
- AZ(vsb_finish(ob[fd]));
- if (vsb_len(ob[fd]) > 1 && VSL_Matched(vd, bitmap[fd])) {
- printf("%s", vsb_data(ob[fd]));
+ AZ(VSB_finish(ob[fd]));
+ if (VSB_len(ob[fd]) > 1 && VSL_Matched(vd, bitmap[fd])) {
+ printf("%s", VSB_data(ob[fd]));
}
bitmap[fd] = 0;
- vsb_clear(ob[fd]);
+ VSB_clear(ob[fd]);
}
static void
@@ -79,13 +79,13 @@ clean_order(struct VSM_data *vd)
for (u = 0; u < 65536; u++) {
if (ob[u] == NULL)
continue;
- AZ(vsb_finish(ob[u]));
- if (vsb_len(ob[u]) > 1 && VSL_Matched(vd, bitmap[u])) {
- printf("%s\n", vsb_data(ob[u]));
+ AZ(VSB_finish(ob[u]));
+ if (VSB_len(ob[u]) > 1 && VSL_Matched(vd, bitmap[u])) {
+ printf("%s\n", VSB_data(ob[u]));
}
flg[u] = 0;
bitmap[u] = 0;
- vsb_clear(ob[u]);
+ VSB_clear(ob[u]);
}
}
@@ -108,7 +108,7 @@ h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
return (0);
}
if (ob[fd] == NULL) {
- ob[fd] = vsb_new_auto();
+ ob[fd] = VSB_new_auto();
assert(ob[fd] != NULL);
}
if ((tag == SLT_BackendOpen || tag == SLT_SessionOpen ||
@@ -117,14 +117,14 @@ h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
last[fd] != SLT_VCL_acl) ||
(tag == SLT_BackendXID &&
last[fd] != SLT_BackendOpen)) &&
- vsb_len(ob[fd]) != 0) {
+ VSB_len(ob[fd]) != 0) {
/*
* This is the start of a new request, yet we haven't seen
* the end of the previous one. Spit it out anyway before
* starting on the new one.
*/
if (last[fd] != SLT_SessionClose)
- vsb_printf(ob[fd], "%5d %-12s %c %s\n",
+ VSB_printf(ob[fd], "%5d %-12s %c %s\n",
fd, "Interrupted", type, VSL_tags[tag]);
h_order_finish(fd, vd);
}
@@ -134,17 +134,17 @@ h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
switch (tag) {
case SLT_VCL_call:
if (flg[fd] & F_INVCL)
- vsb_cat(ob[fd], "\n");
+ VSB_cat(ob[fd], "\n");
else
flg[fd] |= F_INVCL;
- vsb_printf(ob[fd], "%5d %-12s %c %.*s",
+ VSB_printf(ob[fd], "%5d %-12s %c %.*s",
fd, VSL_tags[tag], type, len, ptr);
return (0);
case SLT_VCL_trace:
case SLT_VCL_return:
if (flg[fd] & F_INVCL) {
- vsb_cat(ob[fd], " ");
- vsb_bcat(ob[fd], ptr, len);
+ VSB_cat(ob[fd], " ");
+ VSB_bcat(ob[fd], ptr, len);
return (0);
}
break;
@@ -152,10 +152,10 @@ h_order(void *priv, enum vsl_tag tag, unsigned fd, unsigned len,
break;
}
if (flg[fd] & F_INVCL) {
- vsb_cat(ob[fd], "\n");
+ VSB_cat(ob[fd], "\n");
flg[fd] &= ~F_INVCL;
}
- vsb_printf(ob[fd], "%5d %-12s %c %.*s\n",
+ VSB_printf(ob[fd], "%5d %-12s %c %.*s\n",
fd, VSL_tags[tag], type, len, ptr);
switch (tag) {
case SLT_ReqEnd:
diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c
index e893be1..2c54808 100644
--- a/bin/varnishtest/vtc.c
+++ b/bin/varnishtest/vtc.c
@@ -161,18 +161,18 @@ macro_expand(struct vtclog *vl, const char *text)
const char *p, *q;
char *m;
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
while (*text != '\0') {
p = strstr(text, "${");
if (p == NULL) {
- vsb_cat(vsb, text);
+ VSB_cat(vsb, text);
break;
}
- vsb_bcat(vsb, text, p - text);
+ VSB_bcat(vsb, text, p - text);
q = strchr(p, '}');
if (q == NULL) {
- vsb_cat(vsb, text);
+ VSB_cat(vsb, text);
break;
}
assert(p[0] == '$');
@@ -181,14 +181,14 @@ macro_expand(struct vtclog *vl, const char *text)
p += 2;
m = macro_get(p, q);
if (m == NULL) {
- vsb_delete(vsb);
+ VSB_delete(vsb);
vtc_log(vl, 0, "Macro ${%s} not found", p);
return (NULL);
}
- vsb_printf(vsb, "%s", m);
+ VSB_printf(vsb, "%s", m);
text = q + 1;
}
- AZ(vsb_finish(vsb));
+ AZ(VSB_finish(vsb));
return (vsb);
}
@@ -288,7 +288,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl)
token_exp[tn] = macro_expand(vl, token_s[tn]);
if (vtc_error)
return;
- token_s[tn] = vsb_data(token_exp[tn]);
+ token_s[tn] = VSB_data(token_exp[tn]);
token_e[tn] = strchr(token_s[tn], '\0');
}
diff --git a/bin/varnishtest/vtc_client.c b/bin/varnishtest/vtc_client.c
index c7a2588..4f3e984 100644
--- a/bin/varnishtest/vtc_client.c
+++ b/bin/varnishtest/vtc_client.c
@@ -94,21 +94,21 @@ client_thread(void *priv)
if (c->repeat != 1)
vtc_log(vl, 2, "Started (%u iterations)", c->repeat);
for (u = 0; u < c->repeat; u++) {
- vtc_log(vl, 3, "Connect to %s", vsb_data(vsb));
- fd = VSS_open(vsb_data(vsb), 10.);
+ vtc_log(vl, 3, "Connect to %s", VSB_data(vsb));
+ fd = VSS_open(VSB_data(vsb), 10.);
if (fd < 0)
- vtc_log(c->vl, 0, "Failed to open %s", vsb_data(vsb));
+ vtc_log(c->vl, 0, "Failed to open %s", VSB_data(vsb));
assert(fd >= 0);
TCP_blocking(fd);
TCP_myname(fd, mabuf, sizeof mabuf, mpbuf, sizeof mpbuf);
vtc_log(vl, 3, "connected fd %d from %s %s to %s",
- fd, mabuf, mpbuf, vsb_data(vsb));
+ fd, mabuf, mpbuf, VSB_data(vsb));
http_process(vl, c->spec, fd, -1);
vtc_log(vl, 3, "closing fd %d", fd);
TCP_close(&fd);
}
vtc_log(vl, 2, "Ending");
- vsb_delete(vsb);
+ VSB_delete(vsb);
free(p);
return (NULL);
}
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index ea12752..ddd0a8a 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -139,10 +139,10 @@ http_write(const struct http *hp, int lvl, const char *pfx)
{
int l;
- AZ(vsb_finish(hp->vsb));
- vtc_dump(hp->vl, lvl, pfx, vsb_data(hp->vsb), vsb_len(hp->vsb));
- l = write(hp->fd, vsb_data(hp->vsb), vsb_len(hp->vsb));
- if (l != vsb_len(hp->vsb))
+ AZ(VSB_finish(hp->vsb));
+ vtc_dump(hp->vl, lvl, pfx, VSB_data(hp->vsb), VSB_len(hp->vsb));
+ l = write(hp->fd, VSB_data(hp->vsb), VSB_len(hp->vsb));
+ if (l != VSB_len(hp->vsb))
vtc_log(hp->vl, 0, "Write failed: %s", strerror(errno));
}
@@ -646,7 +646,7 @@ cmd_http_txresp(CMD_ARGS)
assert(!strcmp(av[0], "txresp"));
av++;
- vsb_clear(hp->vsb);
+ VSB_clear(hp->vsb);
/* send a "Content-Length: 0" header unless something else happens */
REPLACE(body, "");
@@ -667,13 +667,13 @@ cmd_http_txresp(CMD_ARGS)
break;
}
- vsb_printf(hp->vsb, "%s %s %s%s", proto, status, msg, nl);
+ VSB_printf(hp->vsb, "%s %s %s%s", proto, status, msg, nl);
for(; *av != NULL; av++) {
if (!strcmp(*av, "-nolen")) {
nolen = 1;
} else if (!strcmp(*av, "-hdr")) {
- vsb_printf(hp->vsb, "%s%s", av[1], nl);
+ VSB_printf(hp->vsb, "%s%s", av[1], nl);
av++;
} else
break;
@@ -711,13 +711,13 @@ cmd_http_txresp(CMD_ARGS)
assert(body == nullbody);
b = synth_body(av[1], 1);
gzip_body(hp, b, &body, &bodylen);
- vsb_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
+ VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
av++;
} else if (!strcmp(*av, "-gzipbody")) {
assert(body == nullbody);
gzip_body(hp, av[1], &body, &bodylen);
- vsb_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
+ VSB_printf(hp->vsb, "Content-Encoding: gzip%s", nl);
// vtc_hexdump(hp->vl, 4, "gzip", (void*)body, bodylen);
av++;
} else
@@ -726,10 +726,10 @@ cmd_http_txresp(CMD_ARGS)
if (*av != NULL)
vtc_log(hp->vl, 0, "Unknown http txresp spec: %s\n", *av);
if (body != NULL && !nolen)
- vsb_printf(hp->vsb, "Content-Length: %d%s", bodylen, nl);
- vsb_cat(hp->vsb, nl);
+ VSB_printf(hp->vsb, "Content-Length: %d%s", bodylen, nl);
+ VSB_cat(hp->vsb, nl);
if (body != NULL)
- vsb_bcat(hp->vsb, body, bodylen);
+ VSB_bcat(hp->vsb, body, bodylen);
http_write(hp, 4, "txresp");
}
@@ -833,7 +833,7 @@ cmd_http_txreq(CMD_ARGS)
assert(!strcmp(av[0], "txreq"));
av++;
- vsb_clear(hp->vsb);
+ VSB_clear(hp->vsb);
for(; *av != NULL; av++) {
if (!strcmp(*av, "-url")) {
@@ -848,10 +848,10 @@ cmd_http_txreq(CMD_ARGS)
} else
break;
}
- vsb_printf(hp->vsb, "%s %s %s%s", req, url, proto, nl);
+ VSB_printf(hp->vsb, "%s %s %s%s", req, url, proto, nl);
for(; *av != NULL; av++) {
if (!strcmp(*av, "-hdr")) {
- vsb_printf(hp->vsb, "%s%s", av[1], nl);
+ VSB_printf(hp->vsb, "%s%s", av[1], nl);
av++;
} else
break;
@@ -871,12 +871,12 @@ cmd_http_txreq(CMD_ARGS)
if (*av != NULL)
vtc_log(hp->vl, 0, "Unknown http txreq spec: %s\n", *av);
if (body != NULL)
- vsb_printf(hp->vsb, "Content-Length: %ju%s",
+ VSB_printf(hp->vsb, "Content-Length: %ju%s",
(uintmax_t)strlen(body), nl);
- vsb_cat(hp->vsb, nl);
+ VSB_cat(hp->vsb, nl);
if (body != NULL) {
- vsb_cat(hp->vsb, body);
- vsb_cat(hp->vsb, nl);
+ VSB_cat(hp->vsb, body);
+ VSB_cat(hp->vsb, nl);
}
http_write(hp, 4, "txreq");
}
@@ -916,8 +916,8 @@ cmd_http_chunked(CMD_ARGS)
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AN(av[1]);
AZ(av[2]);
- vsb_clear(hp->vsb);
- vsb_printf(hp->vsb, "%jx%s%s%s",
+ VSB_clear(hp->vsb);
+ VSB_printf(hp->vsb, "%jx%s%s%s",
(uintmax_t)strlen(av[1]), nl, av[1], nl);
http_write(hp, 4, "chunked");
}
@@ -935,24 +935,24 @@ cmd_http_chunkedlen(CMD_ARGS)
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AN(av[1]);
AZ(av[2]);
- vsb_clear(hp->vsb);
+ VSB_clear(hp->vsb);
len = atoi(av[1]);
if (len == 0) {
- vsb_printf(hp->vsb, "0%s%s", nl, nl);
+ VSB_printf(hp->vsb, "0%s%s", nl, nl);
} else {
for (u = 0; u < sizeof buf; u++)
buf[u] = (u & 7) + '0';
- vsb_printf(hp->vsb, "%x%s", len, nl);
+ VSB_printf(hp->vsb, "%x%s", len, nl);
for (u = 0; u < len; u += v) {
v = len - u;
if (v > sizeof buf)
v = sizeof buf;
- vsb_bcat(hp->vsb, buf, v);
+ VSB_bcat(hp->vsb, buf, v);
}
- vsb_printf(hp->vsb, "%s", nl);
+ VSB_printf(hp->vsb, "%s", nl);
}
http_write(hp, 4, "chunked");
}
@@ -1101,7 +1101,7 @@ http_process(struct vtclog *vl, const char *spec, int sock, int sfd)
hp->fd = sock;
hp->timeout = 5000;
hp->nrxbuf = 640*1024;
- hp->vsb = vsb_new_auto();
+ hp->vsb = VSB_new_auto();
hp->rxbuf = malloc(hp->nrxbuf); /* XXX */
hp->sfd = sfd;
hp->vl = vl;
@@ -1115,7 +1115,7 @@ http_process(struct vtclog *vl, const char *spec, int sock, int sfd)
assert(q > s);
AN(s);
parse_string(s, http_cmds, hp, vl);
- vsb_delete(hp->vsb);
+ VSB_delete(hp->vsb);
free(hp->rxbuf);
free(hp);
}
diff --git a/bin/varnishtest/vtc_log.c b/bin/varnishtest/vtc_log.c
index ebeb7df..8ad19e0 100644
--- a/bin/varnishtest/vtc_log.c
+++ b/bin/varnishtest/vtc_log.c
@@ -81,7 +81,7 @@ vtc_logopen(const char *id)
ALLOC_OBJ(vl, VTCLOG_MAGIC);
AN(vl);
vl->id = id;
- vl->vsb = vsb_new_auto();
+ vl->vsb = VSB_new_auto();
AZ(pthread_mutex_init(&vl->mtx, NULL));
AZ(pthread_setspecific(log_key, vl));
return (vl);
@@ -92,7 +92,7 @@ vtc_logclose(struct vtclog *vl)
{
CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC);
- vsb_delete(vl->vsb);
+ VSB_delete(vl->vsb);
AZ(pthread_mutex_destroy(&vl->mtx));
FREE_OBJ(vl);
}
@@ -114,10 +114,10 @@ vtc_log_emit(const struct vtclog *vl, unsigned lvl)
if (vtc_stop && lvl == 0)
return;
- l = vsb_len(vl->vsb);
+ l = VSB_len(vl->vsb);
AZ(pthread_mutex_lock(&vtclog_mtx));
assert(vtclog_left > l);
- memcpy(vtclog_buf,vsb_data(vl->vsb), l);
+ memcpy(vtclog_buf,VSB_data(vl->vsb), l);
vtclog_buf += l;
*vtclog_buf = '\0';
vtclog_left -= l;
@@ -134,18 +134,18 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
tx = TIM_mono() - t0;
AZ(pthread_mutex_lock(&vl->mtx));
assert(lvl < NLEAD);
- vsb_clear(vl->vsb);
- vsb_printf(vl->vsb, "%s %-4s %4.1f ", lead[lvl], vl->id, tx);
+ VSB_clear(vl->vsb);
+ VSB_printf(vl->vsb, "%s %-4s %4.1f ", lead[lvl], vl->id, tx);
va_list ap;
va_start(ap, fmt);
- (void)vsb_vprintf(vl->vsb, fmt, ap);
+ (void)VSB_vprintf(vl->vsb, fmt, ap);
va_end(ap);
- vsb_putc(vl->vsb, '\n');
- AZ(vsb_finish(vl->vsb));
+ VSB_putc(vl->vsb, '\n');
+ AZ(VSB_finish(vl->vsb));
vtc_log_emit(vl, lvl);
- vsb_clear(vl->vsb);
+ VSB_clear(vl->vsb);
AZ(pthread_mutex_unlock(&vl->mtx));
if (lvl == 0) {
vtc_error = 1;
@@ -170,45 +170,45 @@ vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str, int
tx = TIM_mono() - t0;
assert(lvl < NLEAD);
AZ(pthread_mutex_lock(&vl->mtx));
- vsb_clear(vl->vsb);
+ VSB_clear(vl->vsb);
if (pfx == NULL)
pfx = "";
if (str == NULL)
- vsb_printf(vl->vsb, "%s %-4s %4.1f %s(null)\n",
+ VSB_printf(vl->vsb, "%s %-4s %4.1f %s(null)\n",
lead[lvl], vl->id, tx, pfx);
else {
if (len == -1)
len = strlen(str);
for (l = 0; l < len; l++, str++) {
if (l > 512) {
- vsb_printf(vl->vsb, "...");
+ VSB_printf(vl->vsb, "...");
break;
}
if (nl) {
- vsb_printf(vl->vsb, "%s %-4s %4.1f %s| ",
+ VSB_printf(vl->vsb, "%s %-4s %4.1f %s| ",
lead[lvl], vl->id, tx, pfx);
nl = 0;
}
if (*str == '\r')
- vsb_printf(vl->vsb, "\\r");
+ VSB_printf(vl->vsb, "\\r");
else if (*str == '\t')
- vsb_printf(vl->vsb, "\\t");
+ VSB_printf(vl->vsb, "\\t");
else if (*str == '\n') {
- vsb_printf(vl->vsb, "\\n\n");
+ VSB_printf(vl->vsb, "\\n\n");
nl = 1;
} else if (*str < 0x20 || *str > 0x7e)
- vsb_printf(vl->vsb, "\\x%02x", (*str) & 0xff);
+ VSB_printf(vl->vsb, "\\x%02x", (*str) & 0xff);
else
- vsb_printf(vl->vsb, "%c", *str);
+ VSB_printf(vl->vsb, "%c", *str);
}
}
if (!nl)
- vsb_printf(vl->vsb, "\n");
- AZ(vsb_finish(vl->vsb));
+ VSB_printf(vl->vsb, "\n");
+ AZ(VSB_finish(vl->vsb));
vtc_log_emit(vl, lvl);
- vsb_clear(vl->vsb);
+ VSB_clear(vl->vsb);
AZ(pthread_mutex_unlock(&vl->mtx));
if (lvl == 0) {
vtc_error = 1;
@@ -232,37 +232,37 @@ vtc_hexdump(struct vtclog *vl, unsigned lvl, const char *pfx, const unsigned cha
assert(len >= 0);
assert(lvl < NLEAD);
AZ(pthread_mutex_lock(&vl->mtx));
- vsb_clear(vl->vsb);
+ VSB_clear(vl->vsb);
if (pfx == NULL)
pfx = "";
if (str == NULL)
- vsb_printf(vl->vsb, "%s %-4s %s(null)\n",
+ VSB_printf(vl->vsb, "%s %-4s %s(null)\n",
lead[lvl], vl->id, pfx);
else {
for (l = 0; l < len; l++, str++) {
if (l > 512) {
- vsb_printf(vl->vsb, "...");
+ VSB_printf(vl->vsb, "...");
break;
}
if (nl) {
- vsb_printf(vl->vsb, "%s %-4s %s| ",
+ VSB_printf(vl->vsb, "%s %-4s %s| ",
lead[lvl], vl->id, pfx);
nl = 0;
}
- vsb_printf(vl->vsb, " %02x", *str);
+ VSB_printf(vl->vsb, " %02x", *str);
if ((l & 0xf) == 0xf) {
- vsb_printf(vl->vsb, "\n");
+ VSB_printf(vl->vsb, "\n");
nl = 1;
}
}
}
if (!nl)
- vsb_printf(vl->vsb, "\n");
- AZ(vsb_finish(vl->vsb));
+ VSB_printf(vl->vsb, "\n");
+ AZ(VSB_finish(vl->vsb));
vtc_log_emit(vl, lvl);
- vsb_clear(vl->vsb);
+ VSB_clear(vl->vsb);
AZ(pthread_mutex_unlock(&vl->mtx));
if (lvl == 0) {
vtc_error = 1;
diff --git a/bin/varnishtest/vtc_server.c b/bin/varnishtest/vtc_server.c
index a7871bd..5f88904 100644
--- a/bin/varnishtest/vtc_server.c
+++ b/bin/varnishtest/vtc_server.c
@@ -221,7 +221,7 @@ cmd_server_genvcl(struct vsb *vsb)
struct server *s;
VTAILQ_FOREACH(s, &servers, list) {
- vsb_printf(vsb,
+ VSB_printf(vsb,
"backend %s { .host = \"%s\"; .port = \"%s\"; }\n",
s->name, s->aaddr, s->aport);
}
diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c
index d416a5b..52eafab 100644
--- a/bin/varnishtest/vtc_varnish.c
+++ b/bin/varnishtest/vtc_varnish.c
@@ -137,9 +137,9 @@ varnish_new(const char *name)
bprintf(buf, "${tmpdir}/%s", name);
vsb = macro_expand(v->vl, buf);
AN(vsb);
- v->workdir = strdup(vsb_data(vsb));
+ v->workdir = strdup(VSB_data(vsb));
AN(v->workdir);
- vsb_delete(vsb);
+ VSB_delete(vsb);
bprintf(buf, "rm -rf %s ; mkdir -p %s ; echo ' %ld' > %s/_S",
v->workdir, v->workdir, random(), v->workdir);
@@ -151,11 +151,11 @@ varnish_new(const char *name)
if (*v->name != 'v')
vtc_log(v->vl, 0, "Varnish name must start with 'v'");
- v->args = vsb_new_auto();
+ v->args = VSB_new_auto();
- v->storage = vsb_new_auto();
- vsb_printf(v->storage, "-sfile,%s,10M", v->workdir);
- AZ(vsb_finish(v->storage));
+ v->storage = VSB_new_auto();
+ VSB_printf(v->storage, "-sfile,%s,10M", v->workdir);
+ AZ(VSB_finish(v->storage));
v->cli_fd = -1;
VTAILQ_INSERT_TAIL(&varnishes, v, list);
@@ -247,28 +247,28 @@ varnish_launch(struct varnish *v)
v->cli_fd = VSS_listen(ap[0], 1);
TCP_myname(v->cli_fd, abuf, sizeof abuf, pbuf, sizeof pbuf);
- AZ(vsb_finish(v->args));
+ AZ(VSB_finish(v->args));
vtc_log(v->vl, 2, "Launch");
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
- vsb_printf(vsb, "cd ${topbuild}/bin/varnishd &&");
- vsb_printf(vsb, " ./varnishd -d -d -n %s", v->workdir);
- vsb_printf(vsb, " -l 10m,1m,-");
- vsb_printf(vsb, " -p auto_restart=off");
- vsb_printf(vsb, " -p syslog_cli_traffic=off");
- vsb_printf(vsb, " -a '%s'", "127.0.0.1:0");
- vsb_printf(vsb, " -S %s/_S", v->workdir);
- vsb_printf(vsb, " -M '%s %s'", abuf, pbuf);
- vsb_printf(vsb, " -P %s/varnishd.pid", v->workdir);
- vsb_printf(vsb, " %s", vsb_data(v->storage));
- vsb_printf(vsb, " %s", vsb_data(v->args));
- AZ(vsb_finish(vsb));
- vtc_log(v->vl, 3, "CMD: %s", vsb_data(vsb));
- vsb1 = macro_expand(v->vl, vsb_data(vsb));
+ VSB_printf(vsb, "cd ${topbuild}/bin/varnishd &&");
+ VSB_printf(vsb, " ./varnishd -d -d -n %s", v->workdir);
+ VSB_printf(vsb, " -l 10m,1m,-");
+ VSB_printf(vsb, " -p auto_restart=off");
+ VSB_printf(vsb, " -p syslog_cli_traffic=off");
+ VSB_printf(vsb, " -a '%s'", "127.0.0.1:0");
+ VSB_printf(vsb, " -S %s/_S", v->workdir);
+ VSB_printf(vsb, " -M '%s %s'", abuf, pbuf);
+ VSB_printf(vsb, " -P %s/varnishd.pid", v->workdir);
+ VSB_printf(vsb, " %s", VSB_data(v->storage));
+ VSB_printf(vsb, " %s", VSB_data(v->args));
+ AZ(VSB_finish(vsb));
+ vtc_log(v->vl, 3, "CMD: %s", VSB_data(vsb));
+ vsb1 = macro_expand(v->vl, VSB_data(vsb));
AN(vsb1);
- vsb_delete(vsb);
+ VSB_delete(vsb);
vsb = vsb1;
- vtc_log(v->vl, 3, "CMD: %s", vsb_data(vsb));
+ vtc_log(v->vl, 3, "CMD: %s", VSB_data(vsb));
AZ(pipe(&v->fds[0]));
AZ(pipe(&v->fds[2]));
v->pid = fork();
@@ -283,7 +283,7 @@ varnish_launch(struct varnish *v)
AZ(close(v->fds[3]));
for (i = 3; i <getdtablesize(); i++)
(void)close(i);
- AZ(execl("/bin/sh", "/bin/sh", "-c", vsb_data(vsb), NULL));
+ AZ(execl("/bin/sh", "/bin/sh", "-c", VSB_data(vsb), NULL));
exit(1);
} else {
vtc_log(v->vl, 3, "PID: %d", v->pid);
@@ -292,7 +292,7 @@ varnish_launch(struct varnish *v)
AZ(close(v->fds[3]));
v->fds[0] = v->fds[2];
v->fds[2] = v->fds[3] = -1;
- vsb_delete(vsb);
+ VSB_delete(vsb);
AZ(pthread_create(&v->tp, NULL, varnish_thread, v));
/* Wait for the varnish to call home */
@@ -504,31 +504,31 @@ varnish_vcl(struct varnish *v, const char *vcl, enum cli_status_e expect)
varnish_launch(v);
if (vtc_error)
return;
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
- vsb_printf(vsb, "vcl.inline vcl%d << %s\n%s\n%s\n",
+ VSB_printf(vsb, "vcl.inline vcl%d << %s\n%s\n%s\n",
++v->vcl_nbr, NONSENSE, vcl, NONSENSE);
- AZ(vsb_finish(vsb));
+ AZ(VSB_finish(vsb));
- u = varnish_ask_cli(v, vsb_data(vsb), NULL);
+ u = varnish_ask_cli(v, VSB_data(vsb), NULL);
if (u != expect) {
- vsb_delete(vsb);
+ VSB_delete(vsb);
vtc_log(v->vl, 0,
"VCL compilation got %u expected %u",
u, expect);
return;
}
if (u == CLIS_OK) {
- vsb_clear(vsb);
- vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
- AZ(vsb_finish(vsb));
- u = varnish_ask_cli(v, vsb_data(vsb), NULL);
+ VSB_clear(vsb);
+ VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
+ AZ(VSB_finish(vsb));
+ u = varnish_ask_cli(v, VSB_data(vsb), NULL);
assert(u == CLIS_OK);
} else {
vtc_log(v->vl, 2, "VCL compilation failed (as expected)");
}
- vsb_delete(vsb);
+ VSB_delete(vsb);
}
/**********************************************************************
@@ -545,33 +545,33 @@ varnish_vclbackend(struct varnish *v, const char *vcl)
varnish_launch(v);
if (vtc_error)
return;
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
- vsb2 = vsb_new_auto();
+ vsb2 = VSB_new_auto();
AN(vsb2);
cmd_server_genvcl(vsb2);
- AZ(vsb_finish(vsb2));
+ AZ(VSB_finish(vsb2));
- vsb_printf(vsb, "vcl.inline vcl%d << %s\n%s\n%s\n%s\n",
- ++v->vcl_nbr, NONSENSE, vsb_data(vsb2), vcl, NONSENSE);
- AZ(vsb_finish(vsb));
+ VSB_printf(vsb, "vcl.inline vcl%d << %s\n%s\n%s\n%s\n",
+ ++v->vcl_nbr, NONSENSE, VSB_data(vsb2), vcl, NONSENSE);
+ AZ(VSB_finish(vsb));
- u = varnish_ask_cli(v, vsb_data(vsb), NULL);
+ u = varnish_ask_cli(v, VSB_data(vsb), NULL);
if (u != CLIS_OK) {
- vsb_delete(vsb);
- vsb_delete(vsb2);
+ VSB_delete(vsb);
+ VSB_delete(vsb2);
vtc_log(v->vl, 0, "FAIL VCL does not compile");
return;
}
- vsb_clear(vsb);
- vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
- AZ(vsb_finish(vsb));
- u = varnish_ask_cli(v, vsb_data(vsb), NULL);
+ VSB_clear(vsb);
+ VSB_printf(vsb, "vcl.use vcl%d", v->vcl_nbr);
+ AZ(VSB_finish(vsb));
+ u = varnish_ask_cli(v, VSB_data(vsb), NULL);
assert(u == CLIS_OK);
- vsb_delete(vsb);
- vsb_delete(vsb2);
+ VSB_delete(vsb);
+ VSB_delete(vsb2);
}
/**********************************************************************
@@ -700,17 +700,17 @@ cmd_varnish(CMD_ARGS)
if (vtc_error)
break;
if (!strcmp(*av, "-storage")) {
- vsb_clear(v->storage);
- vsb_cat(v->storage, av[1]);
- AZ(vsb_finish(v->storage));
+ VSB_clear(v->storage);
+ VSB_cat(v->storage, av[1]);
+ AZ(VSB_finish(v->storage));
av++;
continue;
}
if (!strcmp(*av, "-arg")) {
AN(av[1]);
AZ(v->pid);
- vsb_cat(v->args, " ");
- vsb_cat(v->args, av[1]);
+ VSB_cat(v->args, " ");
+ VSB_cat(v->args, av[1]);
av++;
continue;
}
diff --git a/include/vsb.h b/include/vsb.h
index e363a1f..6544cbf 100644
--- a/include/vsb.h
+++ b/include/vsb.h
@@ -46,7 +46,7 @@ struct vsb {
#define VSB_AUTOEXTEND 0x00000001 /* automatically extend buffer */
#define VSB_USRFLAGMSK 0x0000ffff /* mask of flags the user may specify */
#define VSB_DYNAMIC 0x00010000 /* s_buf must be freed */
-#define VSB_FINISHED 0x00020000 /* set by vsb_finish() */
+#define VSB_FINISHED 0x00020000 /* set by VSB_finish() */
#define VSB_DYNSTRUCT 0x00080000 /* vsb must be freed */
int s_flags; /* flags */
};
@@ -61,31 +61,31 @@ extern "C" {
/*
* API functions
*/
-struct vsb *vsb_new(struct vsb *, char *, int, int);
-#define vsb_new_auto() \
- vsb_new(NULL, NULL, 0, VSB_AUTOEXTEND)
-void vsb_clear(struct vsb *);
-int vsb_setpos(struct vsb *, ssize_t);
-int vsb_bcat(struct vsb *, const void *, size_t);
-int vsb_bcpy(struct vsb *, const void *, size_t);
-int vsb_cat(struct vsb *, const char *);
-int vsb_cpy(struct vsb *, const char *);
-int vsb_printf(struct vsb *, const char *, ...)
+struct vsb *VSB_new(struct vsb *, char *, int, int);
+#define VSB_new_auto() \
+ VSB_new(NULL, NULL, 0, VSB_AUTOEXTEND)
+void VSB_clear(struct vsb *);
+int VSB_setpos(struct vsb *, ssize_t);
+int VSB_bcat(struct vsb *, const void *, size_t);
+int VSB_bcpy(struct vsb *, const void *, size_t);
+int VSB_cat(struct vsb *, const char *);
+int VSB_cpy(struct vsb *, const char *);
+int VSB_printf(struct vsb *, const char *, ...)
__printflike(2, 3);
#ifdef va_start
-int vsb_vprintf(struct vsb *, const char *, va_list)
+int VSB_vprintf(struct vsb *, const char *, va_list)
__printflike(2, 0);
#endif
-int vsb_putc(struct vsb *, int);
-int vsb_trim(struct vsb *);
-int vsb_error(const struct vsb *);
-int vsb_finish(struct vsb *);
-char *vsb_data(struct vsb *);
-ssize_t vsb_len(struct vsb *);
-int vsb_done(const struct vsb *);
-void vsb_delete(struct vsb *);
-void vsb_quote(struct vsb *s, const char *p, int len, int how);
-const char *vsb_unquote(struct vsb *s, const char *p, int len, int how);
+int VSB_putc(struct vsb *, int);
+int VSB_trim(struct vsb *);
+int VSB_error(const struct vsb *);
+int VSB_finish(struct vsb *);
+char *VSB_data(struct vsb *);
+ssize_t VSB_len(struct vsb *);
+int VSB_done(const struct vsb *);
+void VSB_delete(struct vsb *);
+void VSB_quote(struct vsb *s, const char *p, int len, int how);
+const char *VSB_unquote(struct vsb *s, const char *p, int len, int how);
#ifdef __cplusplus
};
#endif
diff --git a/lib/libvarnish/cli_common.c b/lib/libvarnish/cli_common.c
index 4fa7429..ca47482 100644
--- a/lib/libvarnish/cli_common.c
+++ b/lib/libvarnish/cli_common.c
@@ -58,7 +58,7 @@ cli_out(struct cli *cli, const char *fmt, ...)
va_start(ap, fmt);
if (cli != NULL)
- (void)vsb_vprintf(cli->sb, fmt, ap);
+ (void)VSB_vprintf(cli->sb, fmt, ap);
else
(void)vfprintf(stdout, fmt, ap);
va_end(ap);
@@ -69,7 +69,7 @@ void
cli_quote(struct cli *cli, const char *s)
{
- vsb_quote(cli->sb, s, -1, 0);
+ VSB_quote(cli->sb, s, -1, 0);
}
void
@@ -97,14 +97,14 @@ cli_writeres(int fd, const struct cli *cli)
assert(cli->result <= 999); /*lint !e650 const out of range */
i = snprintf(res, sizeof res,
- "%-3d %-8ld\n", cli->result, (long)vsb_len(cli->sb));
+ "%-3d %-8ld\n", cli->result, (long)VSB_len(cli->sb));
assert(i == CLI_LINE0_LEN);
iov[0].iov_base = res;
iov[0].iov_len = CLI_LINE0_LEN;
- iov[1].iov_base = vsb_data(cli->sb);
- iov[1].iov_len = vsb_len(cli->sb);
+ iov[1].iov_base = VSB_data(cli->sb);
+ iov[1].iov_len = VSB_len(cli->sb);
iov[2].iov_base = nl;
iov[2].iov_len = 1;
diff --git a/lib/libvarnish/cli_serve.c b/lib/libvarnish/cli_serve.c
index 6306dff..c464de1 100644
--- a/lib/libvarnish/cli_serve.c
+++ b/lib/libvarnish/cli_serve.c
@@ -224,7 +224,7 @@ cls_dispatch(struct cli *cli, struct cli_proto *clp, char * const * av,
}
cli->result = CLIS_OK;
- vsb_clear(cli->sb);
+ VSB_clear(cli->sb);
cp->func(cli, (const char * const *)av, cp->priv);
return (1);
}
@@ -253,7 +253,7 @@ cls_vlu2(void *priv, char * const *av)
cli->cls = cs;
cli->result = CLIS_UNKNOWN;
- vsb_clear(cli->sb);
+ VSB_clear(cli->sb);
cli_out(cli, "Unknown request.\nType 'help' for more info.\n");
if (cs->before != NULL)
@@ -286,7 +286,7 @@ cls_vlu2(void *priv, char * const *av)
}
} while (0);
- AZ(vsb_finish(cli->sb));
+ AZ(VSB_finish(cli->sb));
if (cs->after != NULL)
cs->after(cli);
@@ -343,7 +343,7 @@ cls_vlu(void *priv, const char *p)
}
cfd->argv = av;
cfd->last_idx = i - 2;
- cfd->last_arg = vsb_new_auto();
+ cfd->last_arg = VSB_new_auto();
AN(cfd->last_arg);
return (0);
} else {
@@ -351,23 +351,23 @@ cls_vlu(void *priv, const char *p)
assert(!strcmp(cfd->argv[cfd->last_idx], "<<"));
AN(cfd->argv[cfd->last_idx + 1]);
if (strcmp(p, cfd->argv[cfd->last_idx + 1])) {
- vsb_cat(cfd->last_arg, p);
- vsb_cat(cfd->last_arg, "\n");
+ VSB_cat(cfd->last_arg, p);
+ VSB_cat(cfd->last_arg, "\n");
return (0);
}
- AZ(vsb_finish(cfd->last_arg));
+ AZ(VSB_finish(cfd->last_arg));
free(cfd->argv[cfd->last_idx]);
cfd->argv[cfd->last_idx] = NULL;
free(cfd->argv[cfd->last_idx + 1]);
cfd->argv[cfd->last_idx + 1] = NULL;
- cfd->argv[cfd->last_idx] = vsb_data(cfd->last_arg);
+ cfd->argv[cfd->last_idx] = VSB_data(cfd->last_arg);
i = cls_vlu2(priv, cfd->argv);
cfd->argv[cfd->last_idx] = NULL;
FreeArgv(cfd->argv);
cfd->argv = NULL;
free(cli->cmd);
cli->cmd = NULL;
- vsb_delete(cfd->last_arg);
+ VSB_delete(cfd->last_arg);
cfd->last_arg = NULL;
cfd->last_idx = 0;
return (i);
@@ -405,7 +405,7 @@ CLS_AddFd(struct cls *cs, int fdi, int fdo, cls_cb_f *closefunc, void *priv)
cfd->cli = &cfd->clis;
cfd->cli->magic = CLI_MAGIC;
cfd->cli->vlu = VLU_New(cfd, cls_vlu, cs->maxlen);
- cfd->cli->sb = vsb_new_auto();
+ cfd->cli->sb = VSB_new_auto();
cfd->closefunc = closefunc;
cfd->priv = priv;
AN(cfd->cli->sb);
@@ -424,7 +424,7 @@ cls_close_fd(struct cls *cs, struct cls_fd *cfd)
VTAILQ_REMOVE(&cs->fds, cfd, list);
cs->nfd--;
VLU_Destroy(cfd->cli->vlu);
- vsb_delete(cfd->cli->sb);
+ VSB_delete(cfd->cli->sb);
if (cfd->closefunc == NULL) {
(void)close(cfd->fdi);
if (cfd->fdo != cfd->fdi)
diff --git a/lib/libvarnish/subproc.c b/lib/libvarnish/subproc.c
index 677405e..e2b4264 100644
--- a/lib/libvarnish/subproc.c
+++ b/lib/libvarnish/subproc.c
@@ -56,9 +56,9 @@ sub_vlu(void *priv, const char *str)
sp = priv;
if (!sp->lines++)
- vsb_printf(sp->sb, "Message from %s:\n", sp->name);
+ VSB_printf(sp->sb, "Message from %s:\n", sp->name);
if (sp->maxlines < 0 || sp->lines <= sp->maxlines)
- vsb_printf(sp->sb, "%s\n", str);
+ VSB_printf(sp->sb, "%s\n", str);
return (0);
}
@@ -77,14 +77,14 @@ SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name,
sp.maxlines = maxlines;
if (pipe(p) < 0) {
- vsb_printf(sb, "Starting %s: pipe() failed: %s",
+ VSB_printf(sb, "Starting %s: pipe() failed: %s",
name, strerror(errno));
return (-1);
}
assert(p[0] > STDERR_FILENO);
assert(p[1] > STDERR_FILENO);
if ((pid = fork()) < 0) {
- vsb_printf(sb, "Starting %s: fork() failed: %s",
+ VSB_printf(sb, "Starting %s: fork() failed: %s",
name, strerror(errno));
AZ(close(p[0]));
AZ(close(p[1]));
@@ -108,25 +108,25 @@ SUB_run(struct vsb *sb, sub_func_f *func, void *priv, const char *name,
AZ(close(p[0]));
VLU_Destroy(vlu);
if (sp.maxlines >= 0 && sp.lines > sp.maxlines)
- vsb_printf(sb, "[%d lines truncated]\n",
+ VSB_printf(sb, "[%d lines truncated]\n",
sp.lines - sp.maxlines);
do {
rv = waitpid(pid, &status, 0);
if (rv < 0 && errno != EINTR) {
- vsb_printf(sb, "Running %s: waitpid() failed: %s\n",
+ VSB_printf(sb, "Running %s: waitpid() failed: %s\n",
name, strerror(errno));
return (-1);
}
} while (rv < 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
- vsb_printf(sb, "Running %s failed", name);
+ VSB_printf(sb, "Running %s failed", name);
if (WIFEXITED(status))
- vsb_printf(sb, ", exit %d", WEXITSTATUS(status));
+ VSB_printf(sb, ", exit %d", WEXITSTATUS(status));
if (WIFSIGNALED(status))
- vsb_printf(sb, ", signal %d", WTERMSIG(status));
+ VSB_printf(sb, ", signal %d", WTERMSIG(status));
if (WCOREDUMP(status))
- vsb_printf(sb, ", core dumped");
- vsb_printf(sb, "\n");
+ VSB_printf(sb, ", core dumped");
+ VSB_printf(sb, "\n");
return (-1);
}
return (0);
diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c
index 1806416..75414f7 100644
--- a/lib/libvarnish/vsb.c
+++ b/lib/libvarnish/vsb.c
@@ -76,7 +76,7 @@ __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $")
*/
#if !defined(NDEBUG)
static void
-_assert_vsb_integrity(const char *fun, struct vsb *s)
+_assert_VSB_integrity(const char *fun, struct vsb *s)
{
(void)fun;
@@ -92,7 +92,7 @@ _assert_vsb_integrity(const char *fun, struct vsb *s)
}
static void
-_assert_vsb_state(const char *fun, struct vsb *s, int state)
+_assert_VSB_state(const char *fun, struct vsb *s, int state)
{
(void)fun;
@@ -102,11 +102,11 @@ _assert_vsb_state(const char *fun, struct vsb *s, int state)
("%s called with %sfinished or corrupt vsb", fun,
(state ? "un" : "")));
}
-#define assert_vsb_integrity(s) _assert_vsb_integrity(__func__, (s))
-#define assert_vsb_state(s, i) _assert_vsb_state(__func__, (s), (i))
+#define assert_VSB_integrity(s) _assert_VSB_integrity(__func__, (s))
+#define assert_VSB_state(s, i) _assert_VSB_state(__func__, (s), (i))
#else
-#define assert_vsb_integrity(s) do { } while (0)
-#define assert_vsb_state(s, i) do { } while (0)
+#define assert_VSB_integrity(s) do { } while (0)
+#define assert_VSB_state(s, i) do { } while (0)
#endif
#ifdef CTASSERT
@@ -116,7 +116,7 @@ CTASSERT(powerof2(VSB_MAXEXTENDINCR));
static int
-vsb_extendsize(int size)
+VSB_extendsize(int size)
{
int newsize;
@@ -135,14 +135,14 @@ vsb_extendsize(int size)
* Extend an vsb.
*/
static int
-vsb_extend(struct vsb *s, int addlen)
+VSB_extend(struct vsb *s, int addlen)
{
char *newbuf;
int newsize;
if (!VSB_CANEXTEND(s))
return (-1);
- newsize = vsb_extendsize(s->s_size + addlen);
+ newsize = VSB_extendsize(s->s_size + addlen);
newbuf = SBMALLOC(newsize);
if (newbuf == NULL)
return (-1);
@@ -162,7 +162,7 @@ vsb_extend(struct vsb *s, int addlen)
* big enough to hold at least length characters.
*/
static struct vsb *
-vsb_newbuf(struct vsb *s, char *buf, int length, int flags)
+VSB_newbuf(struct vsb *s, char *buf, int length, int flags)
{
memset(s, 0, sizeof(*s));
@@ -180,7 +180,7 @@ vsb_newbuf(struct vsb *s, char *buf, int length, int flags)
return (s);
if ((flags & VSB_AUTOEXTEND) != 0)
- s->s_size = vsb_extendsize(s->s_size);
+ s->s_size = VSB_extendsize(s->s_size);
s->s_buf = SBMALLOC(s->s_size);
if (s->s_buf == NULL)
@@ -195,7 +195,7 @@ vsb_newbuf(struct vsb *s, char *buf, int length, int flags)
* big enough to hold at least length characters.
*/
struct vsb *
-vsb_new(struct vsb *s, char *buf, int length, int flags)
+VSB_new(struct vsb *s, char *buf, int length, int flags)
{
KASSERT(length >= 0,
@@ -205,12 +205,12 @@ vsb_new(struct vsb *s, char *buf, int length, int flags)
flags &= VSB_USRFLAGMSK;
if (s != NULL)
- return (vsb_newbuf(s, buf, length, flags));
+ return (VSB_newbuf(s, buf, length, flags));
s = SBMALLOC(sizeof(*s));
if (s == NULL)
return (NULL);
- if (vsb_newbuf(s, buf, length, flags) == NULL) {
+ if (VSB_newbuf(s, buf, length, flags) == NULL) {
SBFREE(s);
return (NULL);
}
@@ -222,10 +222,10 @@ vsb_new(struct vsb *s, char *buf, int length, int flags)
* Clear an vsb and reset its position.
*/
void
-vsb_clear(struct vsb *s)
+VSB_clear(struct vsb *s)
{
- assert_vsb_integrity(s);
+ assert_VSB_integrity(s);
/* don't care if it's finished or not */
VSB_CLEARFLAG(s, VSB_FINISHED);
@@ -238,11 +238,11 @@ vsb_clear(struct vsb *s)
* Effectively truncates the vsb at the new position.
*/
int
-vsb_setpos(struct vsb *s, ssize_t pos)
+VSB_setpos(struct vsb *s, ssize_t pos)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
KASSERT(pos >= 0,
("attempt to seek to a negative position (%jd)", (intmax_t)pos));
@@ -262,16 +262,16 @@ vsb_setpos(struct vsb *s, ssize_t pos)
* buffer and marking overflow.
*/
static void
-vsb_put_byte(struct vsb *s, int c)
+VSB_put_byte(struct vsb *s, int c)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
if (s->s_error != 0)
return;
if (VSB_FREESPACE(s) <= 0) {
- if (vsb_extend(s, 1) < 0)
+ if (VSB_extend(s, 1) < 0)
s->s_error = ENOMEM;
if (s->s_error != 0)
return;
@@ -283,18 +283,18 @@ vsb_put_byte(struct vsb *s, int c)
* Append a byte string to an vsb.
*/
int
-vsb_bcat(struct vsb *s, const void *buf, size_t len)
+VSB_bcat(struct vsb *s, const void *buf, size_t len)
{
const char *str = buf;
const char *end = str + len;
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
if (s->s_error != 0)
return (-1);
for (; str < end; str++) {
- vsb_put_byte(s, *str);
+ VSB_put_byte(s, *str);
if (s->s_error != 0)
return (-1);
}
@@ -305,31 +305,31 @@ vsb_bcat(struct vsb *s, const void *buf, size_t len)
* Copy a byte string into an vsb.
*/
int
-vsb_bcpy(struct vsb *s, const void *buf, size_t len)
+VSB_bcpy(struct vsb *s, const void *buf, size_t len)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
- vsb_clear(s);
- return (vsb_bcat(s, buf, len));
+ VSB_clear(s);
+ return (VSB_bcat(s, buf, len));
}
/*
* Append a string to an vsb.
*/
int
-vsb_cat(struct vsb *s, const char *str)
+VSB_cat(struct vsb *s, const char *str)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
if (s->s_error != 0)
return (-1);
while (*str != '\0') {
- vsb_put_byte(s, *str++);
+ VSB_put_byte(s, *str++);
if (s->s_error != 0)
return (-1);
}
@@ -340,27 +340,27 @@ vsb_cat(struct vsb *s, const char *str)
* Copy a string into an vsb.
*/
int
-vsb_cpy(struct vsb *s, const char *str)
+VSB_cpy(struct vsb *s, const char *str)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
- vsb_clear(s);
- return (vsb_cat(s, str));
+ VSB_clear(s);
+ return (VSB_cat(s, str));
}
/*
* Format the given argument list and append the resulting string to an vsb.
*/
int
-vsb_vprintf(struct vsb *s, const char *fmt, va_list ap)
+VSB_vprintf(struct vsb *s, const char *fmt, va_list ap)
{
va_list ap_copy;
int len;
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
KASSERT(fmt != NULL,
("%s called with a NULL format string", __func__));
@@ -371,12 +371,12 @@ vsb_vprintf(struct vsb *s, const char *fmt, va_list ap)
/*
* For the moment, there is no way to get vsnprintf(3) to hand
* back a character at a time, to push everything into
- * vsb_putc_func() as was done for the kernel.
+ * VSB_putc_func() as was done for the kernel.
*
* In userspace, while drains are useful, there's generally
* not a problem attempting to malloc(3) on out of space. So
* expand a userland vsb if there is not enough room for the
- * data produced by vsb_[v]printf(3).
+ * data produced by VSB_[v]printf(3).
*/
do {
@@ -385,7 +385,7 @@ vsb_vprintf(struct vsb *s, const char *fmt, va_list ap)
fmt, ap_copy);
va_end(ap_copy);
} while (len > VSB_FREESPACE(s) &&
- vsb_extend(s, len - VSB_FREESPACE(s)) == 0);
+ VSB_extend(s, len - VSB_FREESPACE(s)) == 0);
/*
* s->s_len is the length of the string, without the terminating nul.
@@ -414,13 +414,13 @@ vsb_vprintf(struct vsb *s, const char *fmt, va_list ap)
* Format the given arguments and append the resulting string to an vsb.
*/
int
-vsb_printf(struct vsb *s, const char *fmt, ...)
+VSB_printf(struct vsb *s, const char *fmt, ...)
{
va_list ap;
int result;
va_start(ap, fmt);
- result = vsb_vprintf(s, fmt, ap);
+ result = VSB_vprintf(s, fmt, ap);
va_end(ap);
return (result);
}
@@ -429,10 +429,10 @@ vsb_printf(struct vsb *s, const char *fmt, ...)
* Append a character to an vsb.
*/
int
-vsb_putc(struct vsb *s, int c)
+VSB_putc(struct vsb *s, int c)
{
- vsb_put_byte(s, c);
+ VSB_put_byte(s, c);
if (s->s_error != 0)
return (-1);
return (0);
@@ -442,11 +442,11 @@ vsb_putc(struct vsb *s, int c)
* Trim whitespace characters from end of an vsb.
*/
int
-vsb_trim(struct vsb *s)
+VSB_trim(struct vsb *s)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
if (s->s_error != 0)
return (-1);
@@ -461,7 +461,7 @@ vsb_trim(struct vsb *s)
* Check if an vsb has an error.
*/
int
-vsb_error(const struct vsb *s)
+VSB_error(const struct vsb *s)
{
return (s->s_error);
@@ -471,11 +471,11 @@ vsb_error(const struct vsb *s)
* Finish off an vsb.
*/
int
-vsb_finish(struct vsb *s)
+VSB_finish(struct vsb *s)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, 0);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, 0);
s->s_buf[s->s_len] = '\0';
VSB_SETFLAG(s, VSB_FINISHED);
@@ -489,11 +489,11 @@ vsb_finish(struct vsb *s)
* Return a pointer to the vsb data.
*/
char *
-vsb_data(struct vsb *s)
+VSB_data(struct vsb *s)
{
- assert_vsb_integrity(s);
- assert_vsb_state(s, VSB_FINISHED);
+ assert_VSB_integrity(s);
+ assert_VSB_state(s, VSB_FINISHED);
return (s->s_buf);
}
@@ -502,10 +502,10 @@ vsb_data(struct vsb *s)
* Return the length of the vsb data.
*/
ssize_t
-vsb_len(struct vsb *s)
+VSB_len(struct vsb *s)
{
- assert_vsb_integrity(s);
+ assert_VSB_integrity(s);
/* don't care if it's finished or not */
if (s->s_error != 0)
@@ -517,11 +517,11 @@ vsb_len(struct vsb *s)
* Clear an vsb, free its buffer if necessary.
*/
void
-vsb_delete(struct vsb *s)
+VSB_delete(struct vsb *s)
{
int isdyn;
- assert_vsb_integrity(s);
+ assert_VSB_integrity(s);
/* don't care if it's finished or not */
if (VSB_ISDYNAMIC(s))
@@ -536,7 +536,7 @@ vsb_delete(struct vsb *s)
* Check if an vsb has been finished.
*/
int
-vsb_done(const struct vsb *s)
+VSB_done(const struct vsb *s)
{
return(VSB_ISFINISHED(s));
@@ -546,7 +546,7 @@ vsb_done(const struct vsb *s)
* Quote a string
*/
void
-vsb_quote(struct vsb *s, const char *p, int len, int how)
+VSB_quote(struct vsb *s, const char *p, int len, int how)
{
const char *q;
int quote = 0;
@@ -562,45 +562,45 @@ vsb_quote(struct vsb *s, const char *p, int len, int how)
}
}
if (!quote) {
- (void)vsb_bcat(s, p, len);
+ (void)VSB_bcat(s, p, len);
return;
}
- (void)vsb_putc(s, '"');
+ (void)VSB_putc(s, '"');
for (q = p; q < p + len; q++) {
switch (*q) {
case ' ':
- (void)vsb_putc(s, *q);
+ (void)VSB_putc(s, *q);
break;
case '\\':
case '"':
- (void)vsb_putc(s, '\\');
- (void)vsb_putc(s, *q);
+ (void)VSB_putc(s, '\\');
+ (void)VSB_putc(s, *q);
break;
case '\n':
- (void)vsb_cat(s, "\\n");
+ (void)VSB_cat(s, "\\n");
break;
case '\r':
- (void)vsb_cat(s, "\\r");
+ (void)VSB_cat(s, "\\r");
break;
case '\t':
- (void)vsb_cat(s, "\\t");
+ (void)VSB_cat(s, "\\t");
break;
default:
if (isgraph(*q))
- (void)vsb_putc(s, *q);
+ (void)VSB_putc(s, *q);
else
- (void)vsb_printf(s, "\\%o", *q & 0xff);
+ (void)VSB_printf(s, "\\%o", *q & 0xff);
break;
}
}
- (void)vsb_putc(s, '"');
+ (void)VSB_putc(s, '"');
}
/*
* Unquote a string
*/
const char *
-vsb_unquote(struct vsb *s, const char *p, int len, int how)
+VSB_unquote(struct vsb *s, const char *p, int len, int how)
{
const char *q;
char *r;
@@ -614,7 +614,7 @@ vsb_unquote(struct vsb *s, const char *p, int len, int how)
for (q = p; q < p + len; q++) {
if (*q != '\\') {
- (void)vsb_bcat(s, q, 1);
+ (void)VSB_bcat(s, q, 1);
continue;
}
if (++q >= p + len)
@@ -622,13 +622,13 @@ vsb_unquote(struct vsb *s, const char *p, int len, int how)
switch(*q) {
case 'n':
- (void)vsb_bcat(s, "\n", 1);
+ (void)VSB_bcat(s, "\n", 1);
continue;
case 'r':
- (void)vsb_bcat(s, "\r", 1);
+ (void)VSB_bcat(s, "\r", 1);
continue;
case 't':
- (void)vsb_bcat(s, "\t", 1);
+ (void)VSB_bcat(s, "\t", 1);
continue;
case '0':
case '1':
@@ -643,11 +643,11 @@ vsb_unquote(struct vsb *s, const char *p, int len, int how)
if (errno != 0 || (u & ~0xff))
return ("\\ooo sequence out of range");
c = (char)u;
- (void)vsb_bcat(s, &c, 1);
+ (void)VSB_bcat(s, &c, 1);
q = r - 1;
continue;
default:
- (void)vsb_bcat(s, q, 1);
+ (void)VSB_bcat(s, q, 1);
}
}
return (NULL);
diff --git a/lib/libvcl/generate.py b/lib/libvcl/generate.py
index 15c1a51..cb9ac40 100755
--- a/lib/libvcl/generate.py
+++ b/lib/libvcl/generate.py
@@ -564,7 +564,7 @@ def emit_vcl_tnames(fo, tokens):
fo.write("};\n")
#######################################################################
-# Read a C-source file and spit out code that outputs it with vsb_cat()
+# Read a C-source file and spit out code that outputs it with VSB_cat()
def emit_file(fo, fn):
fi = open(fn)
@@ -579,7 +579,7 @@ def emit_file(fo, fn):
fo.write("\n\t/* %s */\n\n" % fn)
for c in fc:
if l == 0:
- fo.write("\tvsb_cat(sb, \"")
+ fo.write("\tVSB_cat(sb, \"")
l += 12
x += 12
if x == 0:
diff --git a/lib/libvcl/vcc_acl.c b/lib/libvcl/vcc_acl.c
index e344d3d..9a0d52c 100644
--- a/lib/libvcl/vcc_acl.c
+++ b/lib/libvcl/vcc_acl.c
@@ -101,13 +101,13 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
int i;
if (fam == PF_INET && ae->mask > 32) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Too wide mask (%u) for IPv4 address", ae->mask);
vcc_ErrWhere(tl, ae->t_mask);
return;
}
if (fam == PF_INET6 && ae->mask > 128) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Too wide mask (%u) for IPv6 address", ae->mask);
vcc_ErrWhere(tl, ae->t_mask);
return;
@@ -134,9 +134,9 @@ vcc_acl_add_entry(struct vcc *tl, const struct acl_e *ae, int l,
*/
if (aen->not == ae2->not)
return;
- vsb_printf(tl->sb, "Conflicting ACL entries:\n");
+ VSB_printf(tl->sb, "Conflicting ACL entries:\n");
vcc_ErrWhere(tl, ae2->t_addr);
- vsb_printf(tl->sb, "vs:\n");
+ VSB_printf(tl->sb, "vs:\n");
vcc_ErrWhere(tl, aen->t_addr);
return;
}
@@ -173,7 +173,7 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
error = getaddrinfo(ae->t_addr->dec, "0", &hint, &res0);
if (error) {
if (ae->para) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Warning: %s ignored\n -- %s\n",
ae->t_addr->dec, gai_strerror(error));
Fh(tl, 1, "/* Ignored ACL entry: %s%s",
@@ -185,7 +185,7 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
Fh(tl, 1, " * getaddrinfo: %s */\n",
gai_strerror(error));
} else {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"DNS lookup(%s): %s\n",
ae->t_addr->dec, gai_strerror(error));
vcc_ErrWhere(tl, ae->t_addr);
@@ -217,7 +217,7 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
vcc_acl_add_entry(tl, ae, 16, u, res->ai_family);
break;
default:
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Ignoring unknown protocol family (%d) for %.*s\n",
res->ai_family, PF(ae->t_addr));
continue;
@@ -227,7 +227,7 @@ vcc_acl_try_getaddrinfo(struct vcc *tl, struct acl_e *ae)
freeaddrinfo(res0);
if (ae->t_mask != NULL && i4 > 0 && i6 > 0) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Mask (%u) specified, but string resolves to"
" both IPv4 and IPv6 addresses.\n", ae->mask);
vcc_ErrWhere(tl, ae->t_mask);
@@ -477,7 +477,7 @@ vcc_Acl(struct vcc *tl)
i = vcc_AddDef(tl, an, SYM_ACL);
if (i > 1) {
- vsb_printf(tl->sb, "ACL %.*s redefined\n", PF(an));
+ VSB_printf(tl->sb, "ACL %.*s redefined\n", PF(an));
vcc_ErrWhere(tl, an);
return;
}
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index f90c3b9..c29a749 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -164,7 +164,7 @@ parse_unset(struct vcc *tl)
ERRCHK(tl);
assert(vp != NULL);
if (vp->fmt != STRING || vp->http == NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Only http header variables can be unset.\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -218,7 +218,7 @@ static void
parse_new_syntax(struct vcc *tl)
{
- vsb_printf(tl->sb, "Please change \"%.*s\" to \"return(%.*s)\".\n",
+ VSB_printf(tl->sb, "Please change \"%.*s\" to \"return(%.*s)\".\n",
PF(tl->t), PF(tl->t));
vcc_ErrWhere(tl, tl->t);
}
@@ -274,7 +274,7 @@ parse_return(struct vcc *tl)
#include "vcl_returns.h"
#undef VCL_RET_MAC
if (!retval) {
- vsb_printf(tl->sb, "Expected return action name.\n");
+ VSB_printf(tl->sb, "Expected return action name.\n");
vcc_ErrWhere(tl, tl->t);
ERRCHK(tl);
}
diff --git a/lib/libvcl/vcc_backend.c b/lib/libvcl/vcc_backend.c
index ab102bb..6b2b932 100644
--- a/lib/libvcl/vcc_backend.c
+++ b/lib/libvcl/vcc_backend.c
@@ -123,7 +123,7 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
hint.ai_socktype = SOCK_STREAM;
if (VSS_parse(t_host->dec, &hop, &pop)) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Backend host '%.*s': wrong syntax (unbalanced [...] ?)\n",
PF(t_host) );
vcc_ErrWhere(tl, t_host);
@@ -136,10 +136,10 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
free(hop);
free(pop);
if (error) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Backend host '%.*s'"
" could not be resolved to an IP address:\n", PF(t_host));
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\t%s\n"
"(Sorry if that error message is gibberish.)\n",
gai_strerror(error));
@@ -166,7 +166,7 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
continue;
if (multiple != NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Backend host %.*s: resolves to "
"multiple %s addresses.\n"
"Only one address is allowed.\n"
@@ -178,7 +178,7 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
res1->ai_addrlen, hbuf, sizeof hbuf,
NULL, 0, NI_NUMERICHOST);
AZ(error);
- vsb_printf(tl->sb, "\t%s\n", hbuf);
+ VSB_printf(tl->sb, "\t%s\n", hbuf);
}
vcc_ErrWhere(tl, t_host);
return;
@@ -202,7 +202,7 @@ Emit_Sockaddr(struct vcc *tl, const struct token *t_host, const char *port)
}
freeaddrinfo(res0);
if (retval == 0) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Backend host '%.*s': resolves to "
"neither IPv4 nor IPv6 addresses.\n",
PF(t_host) );
@@ -226,26 +226,26 @@ vcc_EmitBeIdent(const struct vcc *tl, struct vsb *v,
{
assert(first != last);
- vsb_printf(v, "\t.ident =");
+ VSB_printf(v, "\t.ident =");
if (serial >= 0) {
- vsb_printf(v, "\n\t \"%.*s %.*s [%d] \"",
+ VSB_printf(v, "\n\t \"%.*s %.*s [%d] \"",
PF(tl->t_policy), PF(tl->t_dir), serial);
} else {
- vsb_printf(v, "\n\t \"%.*s %.*s \"",
+ VSB_printf(v, "\n\t \"%.*s %.*s \"",
PF(tl->t_policy), PF(tl->t_dir));
}
while (1) {
if (first->dec != NULL)
- vsb_printf(v, "\n\t \"\\\"\" %.*s \"\\\" \"",
+ VSB_printf(v, "\n\t \"\\\"\" %.*s \"\\\" \"",
PF(first));
else
- vsb_printf(v, "\n\t \"%.*s \"", PF(first));
+ VSB_printf(v, "\n\t \"%.*s \"", PF(first));
if (first == last)
break;
first = VTAILQ_NEXT(first, list);
AN(first);
}
- vsb_printf(v, ",\n");
+ VSB_printf(v, ",\n");
}
/*--------------------------------------------------------------------
@@ -259,9 +259,9 @@ vcc_ProbeRedef(struct vcc *tl, struct token **t_did,
/* .url and .request are mutually exclusive */
if (*t_did != NULL) {
- vsb_printf(tl->sb, "Probe request redefinition at:\n");
+ VSB_printf(tl->sb, "Probe request redefinition at:\n");
vcc_ErrWhere(tl, t_field);
- vsb_printf(tl->sb, "Previous definition:\n");
+ VSB_printf(tl->sb, "Previous definition:\n");
vcc_ErrWhere(tl, *t_did);
return;
}
@@ -342,7 +342,7 @@ vcc_ParseProbeSpec(struct vcc *tl)
} else if (vcc_IdIs(t_field, "expected_response")) {
status = vcc_UintVal(tl);
if (status < 100 || status > 999) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Must specify .status with exactly three "
" digits (100 <= x <= 999)\n");
vcc_ErrWhere(tl, tl->t);
@@ -365,13 +365,13 @@ vcc_ParseProbeSpec(struct vcc *tl)
if (t_threshold != NULL || t_window != NULL) {
if (t_threshold == NULL && t_window != NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Must specify .threshold with .window\n");
vcc_ErrWhere(tl, t_window);
return;
} else if (t_threshold != NULL && t_window == NULL) {
if (threshold > 64) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Threshold must be 64 or less.\n");
vcc_ErrWhere(tl, t_threshold);
return;
@@ -379,12 +379,12 @@ vcc_ParseProbeSpec(struct vcc *tl)
window = threshold + 1;
} else if (window > 64) {
AN(t_window);
- vsb_printf(tl->sb, "Window must be 64 or less.\n");
+ VSB_printf(tl->sb, "Window must be 64 or less.\n");
vcc_ErrWhere(tl, t_window);
return;
}
if (threshold > window ) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Threshold can not be greater than window.\n");
AN(t_threshold);
vcc_ErrWhere(tl, t_threshold);
@@ -422,7 +422,7 @@ vcc_ParseProbe(struct vcc *tl)
vcc_NextToken(tl);
i = vcc_AddDef(tl, t_probe, SYM_PROBE);
if (i > 1) {
- vsb_printf(tl->sb, "Probe %.*s redefined\n", PF(t_probe));
+ VSB_printf(tl->sb, "Probe %.*s redefined\n", PF(t_probe));
vcc_ErrWhere(tl, t_probe);
}
@@ -466,7 +466,7 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
SkipToken(tl, '{');
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
tl->fb = vsb;
@@ -480,12 +480,12 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
/* Check for old syntax */
if (tl->t->tok == ID && vcc_IdIs(tl->t, "set")) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"NB: Backend Syntax has changed:\n"
"Remove \"set\" and \"backend\" in front"
" of backend fields.\n" );
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at ");
+ VSB_printf(tl->sb, " at ");
vcc_ErrWhere(tl, tl->t);
return;
}
@@ -541,10 +541,10 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
* not allowed here.
*/
if (u == UINT_MAX) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Value outside allowed range: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
}
ERRCHK(tl);
@@ -560,10 +560,10 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
vcc_NextToken(tl);
SkipToken(tl, ';');
} else if (vcc_IdIs(t_field, "probe")) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Expected '{' or name of probe.");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
return;
} else {
@@ -604,9 +604,9 @@ vcc_ParseHostDef(struct vcc *tl, int serial, const char *vgcname)
vcc_NextToken(tl);
tl->fb = NULL;
- AZ(vsb_finish(vsb));
- Fh(tl, 0, "%s", vsb_data(vsb));
- vsb_delete(vsb);
+ AZ(VSB_finish(vsb));
+ Fh(tl, 0, "%s", VSB_data(vsb));
+ VSB_delete(vsb);
Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"simple\",\n"
"\t VGC_backend_%s, &vgc_dir_priv_%s);\n", vgcname, vgcname);
@@ -641,9 +641,9 @@ vcc_ParseBackendHost(struct vcc *tl, int serial, char **nm)
break;
}
if (h == NULL) {
- vsb_printf(tl->sb, "Reference to unknown backend ");
+ VSB_printf(tl->sb, "Reference to unknown backend ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
return;
}
@@ -658,7 +658,7 @@ vcc_ParseBackendHost(struct vcc *tl, int serial, char **nm)
vcc_ParseHostDef(tl, serial, vgcname);
if (tl->err) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\nIn backend host specification starting at:\n");
vcc_ErrWhere(tl, t);
}
@@ -666,11 +666,11 @@ vcc_ParseBackendHost(struct vcc *tl, int serial, char **nm)
return;
} else {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Expected a backend host specification here, "
"either by name or by {...}\n");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
return;
}
@@ -688,7 +688,7 @@ vcc_DefBackend(struct vcc *tl, const struct token *nm)
sym = VCC_GetSymbolTok(tl, nm, SYM_BACKEND);
AN(sym);
if (sym->ndef > 0) {
- vsb_printf(tl->sb, "Backend %.*s redefined\n", PF(tl->t));
+ VSB_printf(tl->sb, "Backend %.*s redefined\n", PF(tl->t));
vcc_ErrWhere(tl, nm);
return;
}
@@ -768,9 +768,9 @@ vcc_ParseDirector(struct vcc *tl)
if (vcc_IdIs(tl->t_policy, dl->name))
break;
if (dl->name == NULL) {
- vsb_printf(tl->sb, "Unknown director policy: ");
+ VSB_printf(tl->sb, "Unknown director policy: ");
vcc_ErrToken(tl, tl->t_policy);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t_policy);
return;
}
@@ -792,7 +792,7 @@ vcc_ParseDirector(struct vcc *tl)
}
if (tl->err) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\nIn %.*s specification starting at:\n", PF(t_first));
vcc_ErrWhere(tl, t_first);
return;
diff --git a/lib/libvcl/vcc_backend_util.c b/lib/libvcl/vcc_backend_util.c
index 2bde38d..c0c493f 100644
--- a/lib/libvcl/vcc_backend_util.c
+++ b/lib/libvcl/vcc_backend_util.c
@@ -109,17 +109,17 @@ vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs)
fs->found = t_field;
return;
}
- vsb_printf(tl->sb, "Field ");
+ VSB_printf(tl->sb, "Field ");
vcc_ErrToken(tl, t_field);
- vsb_printf(tl->sb, " redefined at:\n");
+ VSB_printf(tl->sb, " redefined at:\n");
vcc_ErrWhere(tl, t_field);
- vsb_printf(tl->sb, "\nFirst defined at:\n");
+ VSB_printf(tl->sb, "\nFirst defined at:\n");
vcc_ErrWhere(tl, fs->found);
return;
}
- vsb_printf(tl->sb, "Unknown field: ");
+ VSB_printf(tl->sb, "Unknown field: ");
vcc_ErrToken(tl, t_field);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, t_field);
return;
}
@@ -130,7 +130,7 @@ vcc_FieldsOk(struct vcc *tl, const struct fld_spec *fs)
for (; fs->name != NULL; fs++) {
if (*fs->name == '!' && fs->found == NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Mandatory field '%s' missing.\n", fs->name + 1);
tl->err = 1;
}
diff --git a/lib/libvcl/vcc_compile.c b/lib/libvcl/vcc_compile.c
index e9f85b9..bde3708 100644
--- a/lib/libvcl/vcc_compile.c
+++ b/lib/libvcl/vcc_compile.c
@@ -154,9 +154,9 @@ Fh(const struct vcc *tl, int indent, const char *fmt, ...)
va_list ap;
if (indent)
- vsb_printf(tl->fh, "%*.*s", tl->hindent, tl->hindent, "");
+ VSB_printf(tl->fh, "%*.*s", tl->hindent, tl->hindent, "");
va_start(ap, fmt);
- vsb_vprintf(tl->fh, fmt, ap);
+ VSB_vprintf(tl->fh, fmt, ap);
va_end(ap);
}
@@ -167,9 +167,9 @@ Fb(const struct vcc *tl, int indent, const char *fmt, ...)
assert(tl->fb != NULL);
if (indent)
- vsb_printf(tl->fb, "%*.*s", tl->indent, tl->indent, "");
+ VSB_printf(tl->fb, "%*.*s", tl->indent, tl->indent, "");
va_start(ap, fmt);
- vsb_vprintf(tl->fb, fmt, ap);
+ VSB_vprintf(tl->fb, fmt, ap);
va_end(ap);
}
@@ -179,9 +179,9 @@ Fc(const struct vcc *tl, int indent, const char *fmt, ...)
va_list ap;
if (indent)
- vsb_printf(tl->fc, "%*.*s", tl->indent, tl->indent, "");
+ VSB_printf(tl->fc, "%*.*s", tl->indent, tl->indent, "");
va_start(ap, fmt);
- vsb_vprintf(tl->fc, fmt, ap);
+ VSB_vprintf(tl->fc, fmt, ap);
va_end(ap);
}
@@ -191,9 +191,9 @@ Fi(const struct vcc *tl, int indent, const char *fmt, ...)
va_list ap;
if (indent)
- vsb_printf(tl->fi, "%*.*s", tl->iindent, tl->iindent, "");
+ VSB_printf(tl->fi, "%*.*s", tl->iindent, tl->iindent, "");
va_start(ap, fmt);
- vsb_vprintf(tl->fi, fmt, ap);
+ VSB_vprintf(tl->fi, fmt, ap);
va_end(ap);
}
@@ -203,9 +203,9 @@ Ff(const struct vcc *tl, int indent, const char *fmt, ...)
va_list ap;
if (indent)
- vsb_printf(tl->ff, "%*.*s", tl->findent, tl->findent, "");
+ VSB_printf(tl->ff, "%*.*s", tl->findent, tl->findent, "");
va_start(ap, fmt);
- vsb_vprintf(tl->ff, fmt, ap);
+ VSB_vprintf(tl->ff, fmt, ap);
va_end(ap);
}
@@ -218,30 +218,30 @@ EncString(struct vsb *sb, const char *b, const char *e, int mode)
if (e == NULL)
e = strchr(b, '\0');
- vsb_cat(sb, "\"");
+ VSB_cat(sb, "\"");
for (; b < e; b++) {
switch (*b) {
case '\\':
case '"':
- vsb_printf(sb, "\\%c", *b);
+ VSB_printf(sb, "\\%c", *b);
break;
case '\n':
- vsb_printf(sb, "\\n");
+ VSB_printf(sb, "\\n");
if (mode)
- vsb_printf(sb, "\"\n\t\"");
+ VSB_printf(sb, "\"\n\t\"");
break;
- case '\t': vsb_printf(sb, "\\t"); break;
- case '\r': vsb_printf(sb, "\\r"); break;
- case ' ': vsb_printf(sb, " "); break;
+ case '\t': VSB_printf(sb, "\\t"); break;
+ case '\r': VSB_printf(sb, "\\r"); break;
+ case ' ': VSB_printf(sb, " "); break;
default:
if (isgraph(*b))
- vsb_printf(sb, "%c", *b);
+ VSB_printf(sb, "%c", *b);
else
- vsb_printf(sb, "\\%03o", *b);
+ VSB_printf(sb, "\\%03o", *b);
break;
}
}
- vsb_cat(sb, "\"");
+ VSB_cat(sb, "\"");
}
void
@@ -311,8 +311,8 @@ EmitInitFunc(const struct vcc *tl)
{
Fc(tl, 0, "\nstatic void\nVGC_Init(struct cli *cli)\n{\n\n");
- AZ(vsb_finish(tl->fi));
- vsb_cat(tl->fc, vsb_data(tl->fi));
+ AZ(VSB_finish(tl->fi));
+ VSB_cat(tl->fc, VSB_data(tl->fi));
Fc(tl, 0, "}\n");
}
@@ -330,8 +330,8 @@ EmitFiniFunc(const struct vcc *tl)
for (u = 0; u < tl->nvmodpriv; u++)
Fc(tl, 0, "\tvmod_priv_fini(&vmod_priv_%u);\n", u);
- AZ(vsb_finish(tl->ff));
- vsb_cat(tl->fc, vsb_data(tl->ff));
+ AZ(VSB_finish(tl->ff));
+ VSB_cat(tl->fc, VSB_data(tl->ff));
Fc(tl, 0, "}\n");
}
@@ -420,7 +420,7 @@ vcc_file_source(const struct vcc *tl, struct vsb *sb, const char *fn)
f = vreadfile(tl->vcl_dir, fn, NULL);
if (f == NULL) {
- vsb_printf(sb, "Cannot read file '%s': %s\n",
+ VSB_printf(sb, "Cannot read file '%s': %s\n",
fn, strerror(errno));
return (NULL);
}
@@ -444,7 +444,7 @@ vcc_resolve_includes(struct vcc *tl)
t1 = VTAILQ_NEXT(t, list);
assert(t1 != NULL); /* There's always an EOI */
if (t1->tok != CSTR) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"include not followed by string constant.\n");
vcc_ErrWhere(tl, t1);
return;
@@ -452,7 +452,7 @@ vcc_resolve_includes(struct vcc *tl)
t2 = VTAILQ_NEXT(t1, list);
assert(t2 != NULL); /* There's always an EOI */
if (t2->tok != ';') {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"include <string> not followed by semicolon.\n");
vcc_ErrWhere(tl, t1);
return;
@@ -507,24 +507,24 @@ vcc_NewVcc(const struct vcc *tl0)
tl->ndirector = 1;
/* General C code */
- tl->fc = vsb_new_auto();
+ tl->fc = VSB_new_auto();
assert(tl->fc != NULL);
/* Forward decls (.h like) */
- tl->fh = vsb_new_auto();
+ tl->fh = VSB_new_auto();
assert(tl->fh != NULL);
/* Init C code */
- tl->fi = vsb_new_auto();
+ tl->fi = VSB_new_auto();
assert(tl->fi != NULL);
/* Finish C code */
- tl->ff = vsb_new_auto();
+ tl->ff = VSB_new_auto();
assert(tl->ff != NULL);
/* body code of methods */
for (i = 0; i < VCL_MET_MAX; i++) {
- tl->fm[i] = vsb_new_auto();
+ tl->fm[i] = VSB_new_auto();
assert(tl->fm[i] != NULL);
}
return (tl);
@@ -558,12 +558,12 @@ vcc_DestroyTokenList(struct vcc *tl, char *ret)
FREE_OBJ(sym);
}
- vsb_delete(tl->fh);
- vsb_delete(tl->fc);
- vsb_delete(tl->fi);
- vsb_delete(tl->ff);
+ VSB_delete(tl->fh);
+ VSB_delete(tl->fc);
+ VSB_delete(tl->fi);
+ VSB_delete(tl->ff);
for (i = 0; i < VCL_MET_MAX; i++)
- vsb_delete(tl->fm[i]);
+ VSB_delete(tl->fm[i]);
free(tl);
return (ret);
@@ -644,7 +644,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
/* Check if we have any backends at all */
if (tl->ndirector == 1) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"No backends or directors found in VCL program, "
"at least one is necessary.\n");
tl->err = 1;
@@ -673,9 +673,9 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
Fc(tl, 1, "\nstatic int\n");
Fc(tl, 1, "VGC_function_%s (struct sess *sp)\n",
method_tab[i].name);
- AZ(vsb_finish(tl->fm[i]));
+ AZ(VSB_finish(tl->fm[i]));
Fc(tl, 1, "{\n");
- Fc(tl, 1, "%s", vsb_data(tl->fm[i]));
+ Fc(tl, 1, "%s", VSB_data(tl->fm[i]));
Fc(tl, 1, "}\n");
}
@@ -688,11 +688,11 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
EmitStruct(tl);
/* Combine it all in the fh vsb */
- AZ(vsb_finish(tl->fc));
- vsb_cat(tl->fh, vsb_data(tl->fc));
- AZ(vsb_finish(tl->fh));
+ AZ(VSB_finish(tl->fc));
+ VSB_cat(tl->fh, VSB_data(tl->fc));
+ AZ(VSB_finish(tl->fh));
- of = strdup(vsb_data(tl->fh));
+ of = strdup(VSB_data(tl->fh));
AN(of);
/* done */
diff --git a/lib/libvcl/vcc_dir_dns.c b/lib/libvcl/vcc_dir_dns.c
index 4fff785..303a33a 100644
--- a/lib/libvcl/vcc_dir_dns.c
+++ b/lib/libvcl/vcc_dir_dns.c
@@ -84,7 +84,7 @@ print_backend(struct vcc *tl,
bprintf(strip, "%u.%u.%u.%u", ip[3], ip[2], ip[1], ip[0]);
tmptok.dec = strip;
bprintf(vgcname, "%.*s_%d", PF(tl->t_dir), serial);
- vsb = vsb_new_auto();
+ vsb = VSB_new_auto();
AN(vsb);
tl->fb = vsb;
Fc(tl, 0, "\t{ .host = VGC_backend_%s },\n",vgcname);
@@ -117,9 +117,9 @@ print_backend(struct vcc *tl,
Fb(tl, 0, "};\n");
tl->fb = NULL;
- AZ(vsb_finish(vsb));
- Fh(tl, 0, "%s", vsb_data(vsb));
- vsb_delete(vsb);
+ AZ(VSB_finish(vsb));
+ Fh(tl, 0, "%s", VSB_data(vsb));
+ VSB_delete(vsb);
Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"simple\",\n"
"\t VGC_backend_%s, &vgc_dir_priv_%s);\n", vgcname, vgcname);
Ff(tl, 0, "\tVRT_fini_dir(cli, VGCDIR(%s));\n", vgcname);
@@ -151,9 +151,9 @@ vcc_dir_dns_makebackend(struct vcc *tl,
ip4end = ip4 | ~mask;
if (ip4 != (ip4 & mask)) {
- vsb_printf(tl->sb, "IP and network mask not compatible: ");
+ VSB_printf(tl->sb, "IP and network mask not compatible: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
ERRCHK(tl);
}
@@ -228,10 +228,10 @@ vcc_dir_dns_parse_backend_options(struct vcc *tl)
* not allowed here.
*/
if (u == UINT_MAX) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Value outside allowed range: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
}
ERRCHK(tl);
@@ -265,9 +265,9 @@ vcc_dir_dns_parse_list(struct vcc *tl, int *serial)
ret = sscanf(tl->t->dec, "%hhu.%hhu.%hhu.%hhu",
&a[0], &a[1], &a[2], &a[3]);
if (ret != 4) {
- vsb_printf(tl->sb, "Incomplete IP supplied: ");
+ VSB_printf(tl->sb, "Incomplete IP supplied: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
ERRCHK(tl);
}
@@ -327,7 +327,7 @@ vcc_ParseDnsDirector(struct vcc *tl)
}
vcc_FieldsOk(tl, fs);
if (tl->err) {
- vsb_printf(tl->sb, "\nIn member host"
+ VSB_printf(tl->sb, "\nIn member host"
" specification starting at:\n");
vcc_ErrWhere(tl, t_be);
return;
diff --git a/lib/libvcl/vcc_dir_random.c b/lib/libvcl/vcc_dir_random.c
index 091d4d7..b1aabc2 100644
--- a/lib/libvcl/vcc_dir_random.c
+++ b/lib/libvcl/vcc_dir_random.c
@@ -100,11 +100,11 @@ vcc_ParseRandomDirector(struct vcc *tl)
u = vcc_UintVal(tl);
ERRCHK(tl);
if (u == 0) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"The .weight must be higher "
"than zero.");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
return;
}
@@ -117,7 +117,7 @@ vcc_ParseRandomDirector(struct vcc *tl)
}
vcc_FieldsOk(tl, mfs);
if (tl->err) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\nIn member host specification starting at:\n");
vcc_ErrWhere(tl, t_be);
return;
diff --git a/lib/libvcl/vcc_dir_round_robin.c b/lib/libvcl/vcc_dir_round_robin.c
index 5292adf..a94a5cc 100644
--- a/lib/libvcl/vcc_dir_round_robin.c
+++ b/lib/libvcl/vcc_dir_round_robin.c
@@ -83,7 +83,7 @@ vcc_ParseRoundRobinDirector(struct vcc *tl)
}
vcc_FieldsOk(tl, fs);
if (tl->err) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\nIn member host specification starting at:\n");
vcc_ErrWhere(tl, t_be);
return;
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 8774d8d..5c201b5 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -79,9 +79,9 @@ vcc_TimeUnit(struct vcc *tl)
else if (vcc_IdIs(tl->t, "w"))
sc = 60.0 * 60.0 * 24.0 * 7.0;
else {
- vsb_printf(tl->sb, "Unknown time unit ");
+ VSB_printf(tl->sb, "Unknown time unit ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, ". Legal are 's', 'm', 'h' and 'd'\n");
+ VSB_printf(tl->sb, ". Legal are 's', 'm', 'h' and 'd'\n");
vcc_ErrWhere(tl, tl->t);
return (1.0);
}
@@ -198,9 +198,9 @@ vcc_ByteVal(struct vcc *tl, double *d)
v = vcc_DoubleVal(tl);
ERRCHK(tl);
if (tl->t->tok != ID) {
- vsb_printf(tl->sb, "Expected BYTES unit (B, KB, MB...) got ");
+ VSB_printf(tl->sb, "Expected BYTES unit (B, KB, MB...) got ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, "\n");
+ VSB_printf(tl->sb, "\n");
vcc_ErrWhere(tl, tl->t);
return;
}
@@ -215,9 +215,9 @@ vcc_ByteVal(struct vcc *tl, double *d)
else if (vcc_IdIs(tl->t, "TB"))
sc = 1024. * 1024. * 1024. * 1024.;
else {
- vsb_printf(tl->sb, "Unknown BYTES unit ");
+ VSB_printf(tl->sb, "Unknown BYTES unit ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
". Legal are 'B', 'KB', 'MB', 'GB' and 'TB'\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -250,7 +250,7 @@ vcc_new_expr(void)
/* XXX: use TlAlloc() ? */
ALLOC_OBJ(e, EXPR_MAGIC);
AN(e);
- e->vsb = vsb_new_auto();
+ e->vsb = VSB_new_auto();
e->fmt = VOID;
return (e);
}
@@ -264,9 +264,9 @@ vcc_mk_expr(enum var_type fmt, const char *str, ...)
e = vcc_new_expr();
e->fmt = fmt;
va_start(ap, str);
- vsb_vprintf(e->vsb, str, ap);
+ VSB_vprintf(e->vsb, str, ap);
va_end(ap);
- AZ(vsb_finish(e->vsb));
+ AZ(VSB_finish(e->vsb));
return (e);
}
@@ -276,7 +276,7 @@ vcc_delete_expr(struct expr *e)
if (e == NULL)
return;
CHECK_OBJ_NOTNULL(e, EXPR_MAGIC);
- vsb_delete(e->vsb);
+ VSB_delete(e->vsb);
FREE_OBJ(e);
}
/*--------------------------------------------------------------------
@@ -311,29 +311,29 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
while (*p != '\0') {
if (*p == '\n') {
if (!nl)
- vsb_putc(e->vsb, *p);
+ VSB_putc(e->vsb, *p);
nl = 1;
p++;
continue;
}
nl = 0;
if (*p != '\v') {
- vsb_putc(e->vsb, *p);
+ VSB_putc(e->vsb, *p);
p++;
continue;
}
assert(*p == '\v');
p++;
switch(*p) {
- case '+': vsb_cat(e->vsb, "\v+"); break;
- case '-': vsb_cat(e->vsb, "\v-"); break;
+ case '+': VSB_cat(e->vsb, "\v+"); break;
+ case '-': VSB_cat(e->vsb, "\v-"); break;
case '1':
case '2':
if (*p == '1')
- vsb_cat(e->vsb, vsb_data(e1->vsb));
+ VSB_cat(e->vsb, VSB_data(e1->vsb));
else {
AN(e2);
- vsb_cat(e->vsb, vsb_data(e2->vsb));
+ VSB_cat(e->vsb, VSB_data(e2->vsb));
}
break;
default:
@@ -341,7 +341,7 @@ vcc_expr_edit(enum var_type fmt, const char *p, struct expr *e1,
}
p++;
}
- AZ(vsb_finish(e->vsb));
+ AZ(VSB_finish(e->vsb));
if (e1 != NULL)
e->t1 = e1->t1;
else if (e2 != NULL)
@@ -369,20 +369,20 @@ vcc_expr_fmt(struct vsb *d, int ind, const struct expr *e1)
int i;
for (i = 0; i < ind; i++)
- vsb_cat(d, " ");
- p = vsb_data(e1->vsb);
+ VSB_cat(d, " ");
+ p = VSB_data(e1->vsb);
while (*p != '\0') {
if (*p == '\n') {
- vsb_putc(d, '\n');
+ VSB_putc(d, '\n');
if (p[1] != '\0') {
for (i = 0; i < ind; i++)
- vsb_cat(d, " ");
+ VSB_cat(d, " ");
}
p++;
continue;
}
if (*p != '\v') {
- vsb_putc(d, *p);
+ VSB_putc(d, *p);
p++;
continue;
}
@@ -558,10 +558,10 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
p += strlen(p) + 1;
} while (*p != '\0');
if (*p == '\0') {
- vsb_printf(tl->sb, "Wrong enum value.");
- vsb_printf(tl->sb, " Expected one of:\n");
+ VSB_printf(tl->sb, "Wrong enum value.");
+ VSB_printf(tl->sb, " Expected one of:\n");
do {
- vsb_printf(tl->sb, "\t%s\n", r);
+ VSB_printf(tl->sb, "\t%s\n", r);
r += strlen(r) + 1;
} while (*r != '\0');
vcc_ErrWhere(tl, tl->t);
@@ -580,20 +580,20 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
ERRCHK(tl);
SkipToken(tl, ID);
if (sym == NULL) {
- vsb_printf(tl->sb, "Symbol not found.\n");
+ VSB_printf(tl->sb, "Symbol not found.\n");
vcc_ErrWhere(tl, tl->t);
return;
}
vcc_AddUses(tl, tl->t, sym->r_methods, "Not available");
if (sym->kind != SYM_VAR) {
- vsb_printf(tl->sb, "Wrong kind of symbol.\n");
+ VSB_printf(tl->sb, "Wrong kind of symbol.\n");
vcc_ErrWhere(tl, tl->t);
return;
}
AN(sym->var);
v = sym->var;
if (v->http == NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Variable not an HTTP header.\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -605,10 +605,10 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
vcc_expr0(tl, &e1, fmt);
ERRCHK(tl);
if (e1->fmt != fmt) {
- vsb_printf(tl->sb, "Wrong argument type.");
- vsb_printf(tl->sb, " Expected %s.",
+ VSB_printf(tl->sb, "Wrong argument type.");
+ VSB_printf(tl->sb, " Expected %s.",
vcc_Type(fmt));
- vsb_printf(tl->sb, " Got %s.\n",
+ VSB_printf(tl->sb, " Got %s.\n",
vcc_Type(e1->fmt));
vcc_ErrWhere2(tl, e1->t1, tl->t);
return;
@@ -661,9 +661,9 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
*/
sym = VCC_FindSymbol(tl, tl->t, SYM_NONE);
if (sym == NULL || sym->eval == NULL) {
- vsb_printf(tl->sb, "Symbol not found: ");
+ VSB_printf(tl->sb, "Symbol not found: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " (expected type %s):\n",
+ VSB_printf(tl->sb, " (expected type %s):\n",
vcc_Type(fmt));
vcc_ErrWhere(tl, tl->t);
return;
@@ -680,7 +680,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
default:
break;
}
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Symbol type (%s) can not be used in expression.\n",
VCC_SymKind(tl, sym));
vcc_ErrWhere(tl, tl->t);
@@ -693,7 +693,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
e1->t1 = tl->t;
e1->constant = 1;
vcc_NextToken(tl);
- AZ(vsb_finish(e1->vsb));
+ AZ(VSB_finish(e1->vsb));
*e = e1;
break;
case CNUM:
@@ -722,9 +722,9 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
*e = e1;
break;
default:
- vsb_printf(tl->sb, "Unknown token ");
+ VSB_printf(tl->sb, "Unknown token ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " when looking for %s\n\n", vcc_Type(fmt));
+ VSB_printf(tl->sb, " when looking for %s\n\n", vcc_Type(fmt));
vcc_ErrWhere(tl, tl->t);
break;
}
@@ -755,7 +755,7 @@ vcc_expr_mul(struct vcc *tl, struct expr **e, enum var_type fmt)
default:
if (tl->t->tok != '*' && tl->t->tok != '/')
return;
- vsb_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
+ VSB_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
PF(tl->t), vcc_Type(f2));
vcc_ErrWhere(tl, tl->t);
return;
@@ -826,7 +826,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
default:
if (tl->t->tok != '+' && tl->t->tok != '-')
return;
- vsb_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
+ VSB_printf(tl->sb, "Operator %.*s not possible on type %s.\n",
PF(tl->t), vcc_Type(f2));
vcc_ErrWhere(tl, tl->t);
return;
@@ -845,7 +845,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, enum var_type fmt)
(*e)->fmt == BYTES && e2->fmt == BYTES) {
/* OK */
} else if (e2->fmt != f2) {
- vsb_printf(tl->sb, "%s %.*s %s not possible.\n",
+ VSB_printf(tl->sb, "%s %.*s %s not possible.\n",
vcc_Type((*e)->fmt), PF(tk), vcc_Type(e2->fmt));
vcc_ErrWhere2(tl, tk, tl->t);
return;
@@ -922,10 +922,10 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_expr_add(tl, &e2, (*e)->fmt);
ERRCHK(tl);
if (e2->fmt != (*e)->fmt) { /* XXX */
- vsb_printf(tl->sb, "Comparison of different types: ");
- vsb_printf(tl->sb, "%s ", vcc_Type((*e)->fmt));
+ VSB_printf(tl->sb, "Comparison of different types: ");
+ VSB_printf(tl->sb, "%s ", vcc_Type((*e)->fmt));
vcc_ErrToken(tl, tk);
- vsb_printf(tl->sb, " %s\n", vcc_Type(e2->fmt));
+ VSB_printf(tl->sb, " %s\n", vcc_Type(e2->fmt));
vcc_ErrWhere(tl, tk);
return;
}
@@ -979,7 +979,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt)
case T_GEQ:
case '~':
case T_NOMATCH:
- vsb_printf(tl->sb, "Operator %.*s not possible on %s\n",
+ VSB_printf(tl->sb, "Operator %.*s not possible on %s\n",
PF(tl->t), vcc_Type((*e)->fmt));
vcc_ErrWhere(tl, tl->t);
return;
@@ -1018,8 +1018,8 @@ vcc_expr_not(struct vcc *tl, struct expr **e, enum var_type fmt)
*e = vcc_expr_edit(BOOL, "!(\v1)", e2, NULL);
return;
}
- vsb_printf(tl->sb, "'!' must be followed by BOOL, found ");
- vsb_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
+ VSB_printf(tl->sb, "'!' must be followed by BOOL, found ");
+ VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
vcc_ErrWhere2(tl, tk, tl->t);
}
@@ -1047,9 +1047,9 @@ vcc_expr_cand(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_expr_not(tl, &e2, fmt);
ERRCHK(tl);
if (e2->fmt != BOOL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"'&&' must be followed by BOOL, found ");
- vsb_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
+ VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
vcc_ErrWhere2(tl, tk, tl->t);
return;
}
@@ -1082,9 +1082,9 @@ vcc_expr0(struct vcc *tl, struct expr **e, enum var_type fmt)
vcc_expr_cand(tl, &e2, fmt);
ERRCHK(tl);
if (e2->fmt != BOOL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"'||' must be followed by BOOL, found ");
- vsb_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
+ VSB_printf(tl->sb, "%s.\n", vcc_Type(e2->fmt));
vcc_ErrWhere2(tl, tk, tl->t);
return;
}
@@ -1114,7 +1114,7 @@ vcc_Expr(struct vcc *tl, enum var_type fmt)
if (fmt == STRING || fmt == STRING_LIST)
vcc_expr_tostring(&e, fmt);
if (!tl->err && fmt != e->fmt) {
- vsb_printf(tl->sb, "Expression has type %s, expected %s\n",
+ VSB_printf(tl->sb, "Expression has type %s, expected %s\n",
vcc_Type(e->fmt), vcc_Type(fmt));
tl->err = 1;
}
@@ -1124,7 +1124,7 @@ vcc_Expr(struct vcc *tl, enum var_type fmt)
"\v+\n\v1,\nvrt_magic_string_end\v-", e, NULL);
}
vcc_expr_fmt(tl->fb, tl->indent, e);
- vsb_putc(tl->fb, '\n');
+ VSB_putc(tl->fb, '\n');
} else {
if (t1 != tl->t)
vcc_ErrWhere2(tl, t1, tl->t);
@@ -1147,7 +1147,7 @@ vcc_Expr_Call(struct vcc *tl, const struct symbol *sym)
vcc_Eval_Func(tl, &e, sym);
if (!tl->err) {
vcc_expr_fmt(tl->fb, tl->indent, e);
- vsb_cat(tl->fb, ";\n");
+ VSB_cat(tl->fb, ";\n");
} else if (t1 != tl->t) {
vcc_ErrWhere2(tl, t1, tl->t);
}
diff --git a/lib/libvcl/vcc_parse.c b/lib/libvcl/vcc_parse.c
index 34f9c33..bb42709 100644
--- a/lib/libvcl/vcc_parse.c
+++ b/lib/libvcl/vcc_parse.c
@@ -163,7 +163,7 @@ vcc_Compound(struct vcc *tl)
vcc_NextToken(tl);
break;
case EOI:
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"End of input while in compound statement\n");
tl->err = 1;
return;
@@ -177,7 +177,7 @@ vcc_Compound(struct vcc *tl)
/* FALLTHROUGH */
default:
/* We deliberately do not mention inline C */
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Expected an action, 'if', '{' or '}'\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -216,7 +216,7 @@ vcc_Function(struct vcc *tl)
tl->fb = tl->fc;
i = vcc_AddDef(tl, tl->t, SYM_SUB);
if (i > 1) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Function %.*s redefined\n", PF(tl->t));
vcc_ErrWhere(tl, tl->t);
return;
@@ -295,17 +295,17 @@ vcc_Parse(struct vcc *tl)
/* FALLTHROUGH */
default:
/* We deliberately do not mention inline-C */
- vsb_printf(tl->sb, "Expected one of\n\t");
+ VSB_printf(tl->sb, "Expected one of\n\t");
for (tp = toplev; tp->name != NULL; tp++) {
if (tp[1].name == NULL)
- vsb_printf(tl->sb, " or ");
- vsb_printf(tl->sb, "'%s'", tp->name);
+ VSB_printf(tl->sb, " or ");
+ VSB_printf(tl->sb, "'%s'", tp->name);
if (tp[1].name != NULL)
- vsb_printf(tl->sb, ", ");
+ VSB_printf(tl->sb, ", ");
}
- vsb_printf(tl->sb, "\nFound: ");
+ VSB_printf(tl->sb, "\nFound: ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, " at\n");
+ VSB_printf(tl->sb, " at\n");
vcc_ErrWhere(tl, tl->t);
return;
}
diff --git a/lib/libvcl/vcc_string.c b/lib/libvcl/vcc_string.c
index ed42fa2..707a5d1 100644
--- a/lib/libvcl/vcc_string.c
+++ b/lib/libvcl/vcc_string.c
@@ -57,7 +57,7 @@ vcc_regexp(struct vcc *tl)
memset(&t, 0, sizeof t);
t = VRE_compile(tl->t->dec, 0, &error, &erroroffset);
if (t == NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Regexp compilation error:\n\n%s\n\n", error);
vcc_ErrWhere(tl, tl->t);
return (NULL);
diff --git a/lib/libvcl/vcc_symb.c b/lib/libvcl/vcc_symb.c
index 6c457b4..7c5cd1f 100644
--- a/lib/libvcl/vcc_symb.c
+++ b/lib/libvcl/vcc_symb.c
@@ -49,7 +49,7 @@ VCC_SymKind(struct vcc *tl, const struct symbol *s)
#undef VCC_SYMB
default:
ErrInternal(tl);
- vsb_printf(tl->sb, "Symbol Kind 0x%x\n", s->kind);
+ VSB_printf(tl->sb, "Symbol Kind 0x%x\n", s->kind);
return("INTERNALERROR");
}
}
@@ -67,7 +67,7 @@ vcc_AddSymbol(struct vcc *tl, const char *nb, int l, enum symkind kind)
continue;
if (kind != sym->kind)
continue;
- vsb_printf(tl->sb, "Name Collision: <%.*s> <%s>\n",
+ VSB_printf(tl->sb, "Name Collision: <%.*s> <%s>\n",
l, nb, VCC_SymKind(tl, sym));
ErrInternal(tl);
return (NULL);
diff --git a/lib/libvcl/vcc_token.c b/lib/libvcl/vcc_token.c
index 14040b3..bc08427 100644
--- a/lib/libvcl/vcc_token.c
+++ b/lib/libvcl/vcc_token.c
@@ -49,18 +49,18 @@ vcc_ErrToken(const struct vcc *tl, const struct token *t)
{
if (t->tok == EOI)
- vsb_printf(tl->sb, "end of input");
+ VSB_printf(tl->sb, "end of input");
else if (t->tok == CSRC)
- vsb_printf(tl->sb, "C{ ... }C");
+ VSB_printf(tl->sb, "C{ ... }C");
else
- vsb_printf(tl->sb, "'%.*s'", PF(t));
+ VSB_printf(tl->sb, "'%.*s'", PF(t));
}
void
vcc__ErrInternal(struct vcc *tl, const char *func, unsigned line)
{
- vsb_printf(tl->sb, "VCL compiler internal error at %s():%u\n",
+ VSB_printf(tl->sb, "VCL compiler internal error at %s():%u\n",
func, line);
tl->err = 1;
}
@@ -110,7 +110,7 @@ vcc_icoord(struct vsb *vsb, const struct token *t, int tail)
} else
pos++;
}
- vsb_printf(vsb, "('%s' Line %d Pos %d)", t->src->name, lin, pos + 1);
+ VSB_printf(vsb, "('%s' Line %d Pos %d)", t->src->name, lin, pos + 1);
}
/*--------------------------------------------------------------------*/
@@ -141,16 +141,16 @@ vcc_quoteline(const struct vcc *tl, const char *l, const char *le)
y &= ~7;
y += 8;
while (x < y) {
- vsb_bcat(tl->sb, " ", 1);
+ VSB_bcat(tl->sb, " ", 1);
x++;
}
} else {
x++;
y++;
- vsb_bcat(tl->sb, p, 1);
+ VSB_bcat(tl->sb, p, 1);
}
}
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
}
/*--------------------------------------------------------------------
@@ -179,11 +179,11 @@ vcc_markline(const struct vcc *tl, const char *l, const char *le,
} else
y++;
while (x < y) {
- vsb_putc(tl->sb, c);
+ VSB_putc(tl->sb, c);
x++;
}
}
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
}
/*--------------------------------------------------------------------*/
@@ -205,9 +205,9 @@ vcc_ErrWhere2(struct vcc *tl, const struct token *t, const struct token *t2)
if (l1 == l2) {
vcc_icoord(tl->sb, t, 0);
- vsb_cat(tl->sb, " -- ");
+ VSB_cat(tl->sb, " -- ");
vcc_icoord(tl->sb, t2, 1);
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
/* Two tokens on same line */
vcc_quoteline(tl, l1, t->src->e);
vcc_markline(tl, l1, t->src->e, t->b, t2->e);
@@ -218,21 +218,21 @@ vcc_ErrWhere2(struct vcc *tl, const struct token *t, const struct token *t2)
/* XXX: t had better be before t2 */
vcc_icoord(tl->sb, t, 0);
if (l3 + 1 == l2) {
- vsb_cat(tl->sb, " -- ");
+ VSB_cat(tl->sb, " -- ");
vcc_icoord(tl->sb, t2, 1);
}
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
vcc_quoteline(tl, l1, t->src->e);
vcc_markline(tl, l1, t->src->e, t->b, t2->e);
if (l3 + 1 != l2) {
- vsb_cat(tl->sb, "[...]\n");
+ VSB_cat(tl->sb, "[...]\n");
vcc_icoord(tl->sb, t2, 1);
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
}
vcc_quoteline(tl, l2, t->src->e);
vcc_markline(tl, l2, t->src->e, t->b, t2->e);
}
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
tl->err = 1;
}
@@ -243,10 +243,10 @@ vcc_ErrWhere(struct vcc *tl, const struct token *t)
vcc_iline(t, &l1, 0);
vcc_icoord(tl->sb, t, 0);
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
vcc_quoteline(tl, l1, t->src->e);
vcc_markline(tl, l1, t->src->e, t->b, t->e);
- vsb_putc(tl->sb, '\n');
+ VSB_putc(tl->sb, '\n');
tl->err = 1;
}
@@ -258,7 +258,7 @@ vcc_NextToken(struct vcc *tl)
tl->t = VTAILQ_NEXT(tl->t, list);
if (tl->t == NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Ran out of input, something is missing or"
" maybe unbalanced (...) or {...}\n");
tl->err = 1;
@@ -271,9 +271,9 @@ vcc__Expect(struct vcc *tl, unsigned tok, int line)
{
if (tl->t->tok == tok)
return;
- vsb_printf(tl->sb, "Expected %s got ", vcl_tnames[tok]);
+ VSB_printf(tl->sb, "Expected %s got ", vcl_tnames[tok]);
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb, "\n(program line %u), at\n", line);
+ VSB_printf(tl->sb, "\n(program line %u), at\n", line);
vcc_ErrWhere(tl, tl->t);
}
@@ -332,9 +332,9 @@ vcc_ExpectCid(struct vcc *tl)
ERRCHK(tl);
if (vcc_isCid(tl->t))
return;
- vsb_printf(tl->sb, "Identifier ");
+ VSB_printf(tl->sb, "Identifier ");
vcc_ErrToken(tl, tl->t);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
" contains illegal characters, use [0-9a-zA-Z_] only.\n");
vcc_ErrWhere(tl, tl->t);
}
@@ -411,7 +411,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
if (*p == '/' && p[1] == '*') {
for (q = p + 2; q < sp->e; q++) {
if (*q == '/' && q[1] == '*') {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"/* ... */ comment contains /*\n");
vcc_AddToken(tl, EOI, p, p + 2);
vcc_ErrWhere(tl, tl->t);
@@ -427,7 +427,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
if (q < sp->e)
continue;
vcc_AddToken(tl, EOI, p, p + 2);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Unterminated /* ... */ comment, starting at\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -453,7 +453,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
continue;
}
vcc_AddToken(tl, EOI, p, p + 2);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Unterminated inline C source, starting at\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -478,7 +478,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
continue;
}
vcc_AddToken(tl, EOI, p, p + 2);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Unterminated long-string, starting at\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -501,7 +501,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
}
if (*q == '\r' || *q == '\n') {
vcc_AddToken(tl, EOI, p, q);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Unterminated string at\n");
vcc_ErrWhere(tl, tl->t);
return;
@@ -534,7 +534,7 @@ vcc_Lexer(struct vcc *tl, struct source *sp)
continue;
}
vcc_AddToken(tl, EOI, p, p + 1);
- vsb_printf(tl->sb, "Syntax error at\n");
+ VSB_printf(tl->sb, "Syntax error at\n");
vcc_ErrWhere(tl, tl->t);
return;
}
diff --git a/lib/libvcl/vcc_var.c b/lib/libvcl/vcc_var.c
index cb9054a..51d5fcc 100644
--- a/lib/libvcl/vcc_var.c
+++ b/lib/libvcl/vcc_var.c
@@ -94,19 +94,19 @@ vcc_FindVar(struct vcc *tl, const struct token *t, int wr_access,
AN(v);
if (wr_access && v->w_methods == 0) {
- vsb_printf(tl->sb, "Variable ");
+ VSB_printf(tl->sb, "Variable ");
vcc_ErrToken(tl, t);
- vsb_printf(tl->sb, " is read only.");
- vsb_cat(tl->sb, "\nAt: ");
+ VSB_printf(tl->sb, " is read only.");
+ VSB_cat(tl->sb, "\nAt: ");
vcc_ErrWhere(tl, t);
return (NULL);
} else if (wr_access) {
vcc_AddUses(tl, t, v->w_methods, use);
} else if (v->r_methods == 0) {
- vsb_printf(tl->sb, "Variable ");
+ VSB_printf(tl->sb, "Variable ");
vcc_ErrToken(tl, t);
- vsb_printf(tl->sb, " is write only.");
- vsb_cat(tl->sb, "\nAt: ");
+ VSB_printf(tl->sb, " is write only.");
+ VSB_cat(tl->sb, "\nAt: ");
vcc_ErrWhere(tl, t);
return (NULL);
} else {
@@ -115,9 +115,9 @@ vcc_FindVar(struct vcc *tl, const struct token *t, int wr_access,
assert(v->fmt != HEADER);
return (v);
}
- vsb_printf(tl->sb, "Unknown variable ");
+ VSB_printf(tl->sb, "Unknown variable ");
vcc_ErrToken(tl, t);
- vsb_cat(tl->sb, "\nAt: ");
+ VSB_cat(tl->sb, "\nAt: ");
vcc_ErrWhere(tl, t);
return (NULL);
}
@@ -141,7 +141,7 @@ vcc_VarVal(struct vcc *tl, const struct var *vp, const struct token *vt)
Fb(tl, 0, "%u", vcc_UintVal(tl));
} else {
AN(vt);
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"Variable has incompatible type.\n");
vcc_ErrWhere(tl, vt);
return;
diff --git a/lib/libvcl/vcc_vmod.c b/lib/libvcl/vcc_vmod.c
index 731b26d..c54a4e3 100644
--- a/lib/libvcl/vcc_vmod.c
+++ b/lib/libvcl/vcc_vmod.c
@@ -62,16 +62,16 @@ vcc_ParseImport(struct vcc *tl)
osym = VCC_FindSymbol(tl, mod, SYM_NONE);
if (osym != NULL && osym->kind != SYM_VMOD) {
- vsb_printf(tl->sb, "Module %.*s conflics with other symbol.\n",
+ VSB_printf(tl->sb, "Module %.*s conflics with other symbol.\n",
PF(mod));
vcc_ErrWhere2(tl, t1, tl->t);
return;
}
if (osym != NULL) {
- vsb_printf(tl->sb, "Module %.*s already imported.\n",
+ VSB_printf(tl->sb, "Module %.*s already imported.\n",
PF(mod));
vcc_ErrWhere2(tl, t1, tl->t);
- vsb_printf(tl->sb, "Previous import was here:\n");
+ VSB_printf(tl->sb, "Previous import was here:\n");
vcc_ErrWhere2(tl, osym->def_b, osym->def_e);
return;
}
@@ -85,7 +85,7 @@ vcc_ParseImport(struct vcc *tl)
if (tl->t->tok == ID) {
if (!vcc_IdIs(tl->t, "from")) {
- vsb_printf(tl->sb, "Expected 'from path...' at ");
+ VSB_printf(tl->sb, "Expected 'from path...' at ");
vcc_ErrToken(tl, tl->t);
vcc_ErrWhere(tl, tl->t);
return;
@@ -112,7 +112,7 @@ vcc_ParseImport(struct vcc *tl)
hdl = dlopen(fn, RTLD_NOW | RTLD_LOCAL);
if (hdl == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, dlerror());
vcc_ErrWhere(tl, mod);
return;
@@ -120,29 +120,29 @@ vcc_ParseImport(struct vcc *tl)
modname = dlsym(hdl, "Vmod_Name");
if (modname == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Name not found");
vcc_ErrWhere(tl, mod);
return;
}
if (!vcc_IdIs(mod, modname)) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n",
+ VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n",
PF(mod), fn);
- vsb_printf(tl->sb, "\tModule has wrong name: <%s>\n", modname);
+ VSB_printf(tl->sb, "\tModule has wrong name: <%s>\n", modname);
vcc_ErrWhere(tl, mod);
return;
}
proto = dlsym(hdl, "Vmod_Proto");
if (proto == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Proto not found");
vcc_ErrWhere(tl, mod);
return;
}
spec = dlsym(hdl, "Vmod_Spec");
if (spec == NULL) {
- vsb_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
+ VSB_printf(tl->sb, "Could not load module %.*s\n\t%s\n\t%s\n",
PF(mod), fn, "Symbol Vmod_Spec not found");
vcc_ErrWhere(tl, mod);
return;
diff --git a/lib/libvcl/vcc_xref.c b/lib/libvcl/vcc_xref.c
index 3cd2627..240555a 100644
--- a/lib/libvcl/vcc_xref.c
+++ b/lib/libvcl/vcc_xref.c
@@ -105,15 +105,15 @@ vcc_checkref(struct vcc *tl, const struct symbol *sym)
{
if (sym->ndef == 0 && sym->nref != 0) {
- vsb_printf(tl->sb, "Undefined %s %.*s, first reference:\n",
+ VSB_printf(tl->sb, "Undefined %s %.*s, first reference:\n",
VCC_SymKind(tl, sym), PF(sym->def_b));
vcc_ErrWhere(tl, sym->def_b);
} else if (sym->ndef != 0 && sym->nref == 0) {
- vsb_printf(tl->sb, "Unused %s %.*s, defined:\n",
+ VSB_printf(tl->sb, "Unused %s %.*s, defined:\n",
VCC_SymKind(tl, sym), PF(sym->def_b));
vcc_ErrWhere(tl, sym->def_b);
if (!tl->err_unref) {
- vsb_printf(tl->sb, "(That was just a warning)\n");
+ VSB_printf(tl->sb, "(That was just a warning)\n");
tl->err = 0;
}
}
@@ -211,12 +211,12 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
struct proccall *pc;
if (!p->exists) {
- vsb_printf(tl->sb, "Function %.*s does not exist\n",
+ VSB_printf(tl->sb, "Function %.*s does not exist\n",
PF(p->name));
return (1);
}
if (p->active) {
- vsb_printf(tl->sb, "Function recurses on\n");
+ VSB_printf(tl->sb, "Function recurses on\n");
vcc_ErrWhere(tl, p->name);
return (1);
}
@@ -225,13 +225,13 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
#define VCL_RET_MAC(l, U, B) \
if (u & (1 << (VCL_RET_##U))) { \
- vsb_printf(tl->sb, "Invalid return \"" #l "\"\n");\
+ VSB_printf(tl->sb, "Invalid return \"" #l "\"\n");\
vcc_ErrWhere(tl, p->return_tok[VCL_RET_##U]); \
}
#include "vcl_returns.h"
#undef VCL_RET_MAC
- vsb_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
+ VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
PF(p->name));
vcc_ErrWhere(tl, p->name);
return (1);
@@ -239,7 +239,7 @@ vcc_CheckActionRecurse(struct vcc *tl, struct proc *p, unsigned bitmap)
p->active = 1;
VTAILQ_FOREACH(pc, &p->calls, list) {
if (vcc_CheckActionRecurse(tl, pc->p, bitmap)) {
- vsb_printf(tl->sb, "\n...called from \"%.*s\"\n",
+ VSB_printf(tl->sb, "\n...called from \"%.*s\"\n",
PF(p->name));
vcc_ErrWhere(tl, pc->t);
return (1);
@@ -266,16 +266,16 @@ vcc_checkaction1(struct vcc *tl, const struct symbol *sym)
return;
m = method_tab + i;
if (vcc_CheckActionRecurse(tl, p, m->ret_bitmap)) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\n...which is the \"%s\" method\n", m->name);
- vsb_printf(tl->sb, "Legal returns are:");
+ VSB_printf(tl->sb, "Legal returns are:");
#define VCL_RET_MAC(l, U, B) \
if (m->ret_bitmap & ((1 << VCL_RET_##U))) \
- vsb_printf(tl->sb, " \"%s\"", #l);
+ VSB_printf(tl->sb, " \"%s\"", #l);
#include "vcl_returns.h"
#undef VCL_RET_MAC
- vsb_printf(tl->sb, "\n");
+ VSB_printf(tl->sb, "\n");
tl->err = 1;
}
@@ -291,10 +291,10 @@ vcc_checkaction2(struct vcc *tl, const struct symbol *sym)
if (p->called)
return;
- vsb_printf(tl->sb, "Function unused\n");
+ VSB_printf(tl->sb, "Function unused\n");
vcc_ErrWhere(tl, p->name);
if (!tl->err_unref) {
- vsb_printf(tl->sb, "(That was just a warning)\n");
+ VSB_printf(tl->sb, "(That was just a warning)\n");
tl->err = 0;
}
}
@@ -332,18 +332,18 @@ vcc_CheckUseRecurse(struct vcc *tl, const struct proc *p,
pu = vcc_FindIllegalUse(p, m);
if (pu != NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"'%.*s': %s from method '%.*s'.\n",
PF(pu->t), pu->use, PF(p->name));
vcc_ErrWhere(tl, pu->t);
- vsb_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
+ VSB_printf(tl->sb, "\n...in subroutine \"%.*s\"\n",
PF(p->name));
vcc_ErrWhere(tl, p->name);
return (1);
}
VTAILQ_FOREACH(pc, &p->calls, list) {
if (vcc_CheckUseRecurse(tl, pc->p, m)) {
- vsb_printf(tl->sb, "\n...called from \"%.*s\"\n",
+ VSB_printf(tl->sb, "\n...called from \"%.*s\"\n",
PF(p->name));
vcc_ErrWhere(tl, pc->t);
return (1);
@@ -369,15 +369,15 @@ vcc_checkuses(struct vcc *tl, const struct symbol *sym)
m = method_tab + i;
pu = vcc_FindIllegalUse(p, m);
if (pu != NULL) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"'%.*s': %s in method '%.*s'.",
PF(pu->t), pu->use, PF(p->name));
- vsb_cat(tl->sb, "\nAt: ");
+ VSB_cat(tl->sb, "\nAt: ");
vcc_ErrWhere(tl, pu->t);
return;
}
if (vcc_CheckUseRecurse(tl, p, m)) {
- vsb_printf(tl->sb,
+ VSB_printf(tl->sb,
"\n...which is the \"%s\" method\n", m->name);
return;
}
More information about the varnish-commit
mailing list