[4.0] 1026d14 Rearrange some deck-chairs so panic messages can get better.

Lasse Karstensen lkarsten at varnish-software.com
Mon Sep 22 16:38:23 CEST 2014


commit 1026d14191a584e0a9d624218765e8de83c15aa1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jul 29 17:09:17 2014 +0000

    Rearrange some deck-chairs so panic messages can get better.

diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 4a3e820..a2947c6 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -911,15 +911,19 @@ typedef void vcl_fini_f(struct cli *);
 typedef int vcl_func_f(const struct vrt_ctx *ctx);
 """)
 
+def tbl40(a, b):
+	while len(a.expandtabs()) < 40:
+		a += "\t"
+	return a + b
 
 fo.write("\n/* VCL Methods */\n")
-n = 0
+n = 1
 for i in returns:
-	fo.write("#define VCL_MET_%s\t\t(1U << %d)\n" % (i[0].upper(), n))
+	fo.write(tbl40("#define VCL_MET_%s" % i[0].upper(),  "(1U << %d)\n" % n))
 	n += 1
 
-fo.write("\n#define VCL_MET_MAX\t\t%d\n" % n)
-fo.write("\n#define VCL_MET_MASK\t\t0x%x\n" % ((1 << n) - 1))
+fo.write("\n" + tbl40("#define VCL_MET_MAX", "%d\n" % n))
+fo.write("\n" + tbl40("#define VCL_MET_MASK", "0x%x\n" % ((1 << n) - 1)))
 
 
 fo.write("\n/* VCL Returns */\n")
@@ -927,10 +931,10 @@ n = 0
 l = list(rets.keys())
 l.sort()
 for i in l:
-	fo.write("#define VCL_RET_%s\t\t%d\n" % (i.upper(), n))
+	fo.write(tbl40("#define VCL_RET_%s" % i.upper(), "%d\n" % n))
 	n += 1
 
-fo.write("\n#define VCL_RET_MAX\t\t%d\n" % n)
+fo.write("\n" + tbl40("#define VCL_RET_MAX", "%d\n" % n))
 
 
 fo.write("""
diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c
index 31212aa..4077c1c 100644
--- a/lib/libvcc/vcc_compile.c
+++ b/lib/libvcc/vcc_compile.c
@@ -65,6 +65,7 @@
 #include "vfil.h"
 
 struct method method_tab[] = {
+	{ "none", 0U, 0},
 #define VCL_MET_MAC(l,U,m)	{ "vcl_"#l, m, VCL_MET_##U },
 #include "tbl/vcl_returns.h"
 #undef VCL_MET_MAC
@@ -666,7 +667,7 @@ vcc_CompileSource(const struct vcc *tl0, struct vsb *sb, struct source *sp)
 		return (vcc_DestroyTokenList(tl, NULL));
 
 	/* Emit method functions */
-	for (i = 0; i < VCL_MET_MAX; i++) {
+	for (i = 1; i < VCL_MET_MAX; i++) {
 		Fh(tl, 1, "\nint __match_proto__(vcl_func_f)\n");
 		Fh(tl, 1,
 		    "VGC_function_%s(const struct vrt_ctx *ctx);\n",



More information about the varnish-commit mailing list