return;
}
Fb(tl, 0, ");\n");
+ /*
+ * We count the number of operations on the req.hash
+ * variable, so that varnishd can preallocate the worst case
+ * number of slots for composing the hash string.
+ */
+ tl->nhashcount++;
break;
case STRING:
if (tl->t->tok != '=') {
Fc(tl, 0, "\t.nsrc = %u,\n", tl->nsources);
Fc(tl, 0, "\t.srcname = srcname,\n");
Fc(tl, 0, "\t.srcbody = srcbody,\n");
+ Fc(tl, 0, "\t.nhashcount = %u,\n", tl->nhashcount);
#define VCL_RET_MAC(l,u,b,n)
#define VCL_MET_MAC(l,u,b) \
Fc(tl, 0, "\t." #l "_func = VGC_function_vcl_" #l ",\n");
vsb_cat(sb, " const char **srcname;\n");
vsb_cat(sb, " const char **srcbody;\n");
vsb_cat(sb, "\n");
+ vsb_cat(sb, " unsigned nhashcount;\n");
+ vsb_cat(sb, "\n");
vsb_cat(sb, " void *priv;\n");
vsb_cat(sb, "\n");
vsb_cat(sb, " vcl_init_f *init_func;\n");