Commit 28902ab9 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Convert VRT_l_* to "const char *, VCL_STRANDS" format.

parent 211c6960
......@@ -406,15 +406,13 @@ resp_Get_Filter_List(struct req *req)
} \
\
VCL_VOID \
VRT_l_##vcl##_filters(VRT_CTX, const char *str, ...) \
VRT_l_##vcl##_filters(VRT_CTX, const char *str, VCL_STRANDS s) \
{ \
va_list ap; \
const char *b; \
\
(void)str; \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
va_start(ap, str); \
b = VRT_String(ctx->in->ws, NULL, str, ap); \
va_end(ap); \
b = VRT_StrandsWS(ctx->in->ws, str, s); \
if (b == NULL) \
WS_MarkOverflow(ctx->in->ws); \
else \
......
......@@ -50,14 +50,14 @@ static char vrt_hostname[255] = "";
*/
static void
vrt_do_string(VRT_CTX, struct http *hp, int fld,
const char *err, const char *p, va_list ap)
vrt_do_strands(VRT_CTX, struct http *hp, int fld,
const char *err, const char *str, VCL_STRANDS s)
{
const char *b;
CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
b = VRT_String(hp->ws, NULL, p, ap);
b = VRT_StrandsWS(hp->ws, str, s);
if (b == NULL) {
VRT_fail(ctx, "Workspace overflow (%s)", err);
WS_MarkOverflow(hp->ws);
......@@ -72,14 +72,11 @@ vrt_do_string(VRT_CTX, struct http *hp, int fld,
#define VRT_HDR_L(obj, hdr, fld) \
VCL_VOID \
VRT_l_##obj##_##hdr(VRT_CTX, const char *p, ...) \
VRT_l_##obj##_##hdr(VRT_CTX, const char *str, VCL_STRANDS s) \
{ \
va_list ap; \
\
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
va_start(ap, p); \
vrt_do_string(ctx, ctx->http_##obj, fld, #obj "." #hdr, p, ap); \
va_end(ap); \
vrt_do_strands(ctx, ctx->http_##obj, fld, #obj "." #hdr, str, s); \
}
#define VRT_HDR_R(obj, hdr, fld) \
......@@ -316,16 +313,13 @@ VRT_r_client_identity(VRT_CTX)
}
VCL_VOID
VRT_l_client_identity(VRT_CTX, const char *str, ...)
VRT_l_client_identity(VRT_CTX, const char *str, VCL_STRANDS s)
{
va_list ap;
const char *b;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC);
va_start(ap, str);
b = VRT_String(ctx->req->http->ws, NULL, str, ap);
va_end(ap);
b = VRT_StrandsWS(ctx->req->http->ws, str, s);
if (b == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "client.identity");
WS_MarkOverflow(ctx->req->http->ws);
......@@ -441,24 +435,18 @@ VRT_r_beresp_storage_hint(VRT_CTX)
}
VCL_VOID
VRT_l_beresp_storage_hint(VRT_CTX, const char *str, ...)
VRT_l_beresp_storage_hint(VRT_CTX, const char *str, VCL_STRANDS s)
{
const char *p;
va_list ap;
uintptr_t sn;
VCL_STEVEDORE stv;
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
sn = WS_Snapshot(ctx->ws);
va_start(ap, str);
p = VRT_String(ctx->ws, NULL, str, ap);
va_end(ap);
p = VRT_StrandsWS(ctx->ws, str, s);
if (p == NULL) {
VSLb(ctx->vsl, SLT_LostHeader, "storage_hint");
WS_Reset(ctx->ws, sn);
WS_MarkOverflow(ctx->ws);
return;
}
......@@ -466,8 +454,6 @@ VRT_l_beresp_storage_hint(VRT_CTX, const char *str, ...)
stv = VRT_stevedore(p);
if (stv != NULL)
ctx->bo->storage = stv;
WS_Reset(ctx->ws, sn);
}
/*--------------------------------------------------------------------*/
......@@ -950,7 +936,8 @@ VRT_r_resp_do_esi(VRT_CTX)
#define VRT_BODY_L(which) \
VCL_VOID \
VRT_l_##which##_body(VRT_CTX, enum lbody_e type, VCL_STRANDS s) \
VRT_l_##which##_body(VRT_CTX, enum lbody_e type, \
const char *str, VCL_STRANDS s) \
{ \
int n; \
struct vsb *vsb; \
......@@ -959,7 +946,9 @@ VRT_l_##which##_body(VRT_CTX, enum lbody_e type, VCL_STRANDS s) \
assert(type == LBODY_SET || type == LBODY_ADD); \
if (type == LBODY_SET) \
VSB_clear(vsb); \
for (n = 0; n < s->n; n++) \
if (str != NULL) \
VSB_cat(vsb, str); \
for (n = 0; s != NULL && n < s->n; n++) \
if (s->p[n] != NULL) \
VSB_cat(vsb, s->p[n]); \
}
......
......@@ -217,10 +217,9 @@ class vardef(object):
fo.write('\tsym->lname = "VRT_l_%s(ctx, ";\n' % cnam)
s = "void VRT_l_%s(VRT_CTX, " % cnam
if self.typ == "STRING":
s += ctyp.c + ", ...)"
s += ctyp.c + ", VCL_STRANDS)"
elif self.typ == "BODY":
#s += "enum lbody_e, " + ctyp.c + ", VCL_STRANDS)"
s += "enum lbody_e, VCL_STRANDS)"
s += "enum lbody_e, " + ctyp.c + ", VCL_STRANDS)"
else:
s += "VCL_" + self.typ + ")"
varproto(s)
......
......@@ -117,12 +117,12 @@ static const struct assign {
{ DURATION, T_DIV, REAL, "\v / " },
{ DURATION, '=', DURATION },
{ DURATION, 0, DURATION },
{ STRING, T_INCR, STRING_LIST, "\v,\n" },
{ STRING, '=', STRING_LIST },
{ STRING, T_INCR, STRANDS, "\v,\n" },
{ STRING, '=', STRANDS, "0,\n" },
{ HEADER, T_INCR, STRANDS, "VRT_GetHdr(ctx, \v),\n" },
{ HEADER, '=', STRANDS, "NULL,\n" },
{ BODY, '=', STRANDS, "LBODY_SET,\n" },
{ BODY, T_INCR, STRANDS, "LBODY_ADD,\n" },
{ HEADER, '=', STRANDS, "0,\n" },
{ BODY, '=', STRANDS, "LBODY_SET, 0,\n" },
{ BODY, T_INCR, STRANDS, "LBODY_ADD, 0,\n" },
{ VOID, '=', VOID }
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment