[master] 40795e3b4 vcc_expr: Remove vcc_expr_tostring() fmt argument
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Tue Jul 9 16:49:06 UTC 2024
commit 40795e3b4b801e0d2ae20f5873d903dc770bb8c6
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Mon Apr 29 13:50:54 2024 +0200
vcc_expr: Remove vcc_expr_tostring() fmt argument
All call sites pass the STRINGS type, so we can inline it directly.
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 8cda6f12d..326e8b4b9 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -288,19 +288,18 @@ vcc_expr_tobool(struct vcc *tl, struct expr **e)
*/
static void
-vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
+vcc_expr_tostring(struct vcc *tl, struct expr **e)
{
const char *p;
uint8_t constant = EXPR_VAR;
CHECK_OBJ_NOTNULL(*e, EXPR_MAGIC);
- assert(fmt == STRINGS || fmt->stringform);
- assert(fmt != (*e)->fmt);
+ assert((*e)->fmt != STRINGS);
p = (*e)->fmt->tostring;
if (p != NULL) {
AN(*p);
- *e = vcc_expr_edit(tl, fmt, p, *e, NULL);
+ *e = vcc_expr_edit(tl, STRINGS, p, *e, NULL);
(*e)->constant = constant;
(*e)->nstr = 1;
} else {
@@ -816,7 +815,7 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
ERRCHK(tl);
/* Unless asked for a HEADER, fold to string here */
if (*e && fmt != HEADER && (*e)->fmt == HEADER) {
- vcc_expr_tostring(tl, e, STRINGS);
+ vcc_expr_tostring(tl, e);
ERRCHK(tl);
}
return;
@@ -1071,9 +1070,9 @@ vcc_expr_add(struct vcc *tl, struct expr **e, vcc_type_t fmt)
} else if (tk->tok == '+' &&
((*e)->fmt == STRINGS || fmt == STRINGS)) {
if ((*e)->fmt != STRINGS)
- vcc_expr_tostring(tl, e, STRINGS);
+ vcc_expr_tostring(tl, e);
if (e2->fmt != STRINGS)
- vcc_expr_tostring(tl, &e2, STRINGS);
+ vcc_expr_tostring(tl, &e2);
if (vcc_islit(*e) && vcc_isconst(e2)) {
lit = vcc_islit(e2);
*e = vcc_expr_edit(tl, STRINGS,
@@ -1420,7 +1419,7 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
return;
if ((*e)->fmt != STRINGS && fmt->stringform)
- vcc_expr_tostring(tl, e, STRINGS);
+ vcc_expr_tostring(tl, e);
if ((*e)->fmt->stringform) {
VSB_printf(tl->sb, "Cannot convert type %s(%s) to %s(%s)\n",
@@ -1431,7 +1430,7 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
}
if (fmt == BODY && !(*e)->fmt->bodyform)
- vcc_expr_tostring(tl, e, STRINGS);
+ vcc_expr_tostring(tl, e);
if (fmt == BODY && (*e)->fmt->bodyform) {
if ((*e)->fmt == STRINGS)
More information about the varnish-commit
mailing list