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