[master] 2e5f359 convenience masks for checking ctx->method against task

Nils Goroll nils.goroll at uplex.de
Thu Nov 2 13:51:06 UTC 2017


commit 2e5f359858176b0ce6b14ea8a7daf4b487c1b1d8
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Thu Nov 2 14:47:12 2017 +0100

    convenience masks for checking ctx->method against task

diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index d1c7dd4..2ff3857 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -1125,14 +1125,23 @@ def tbl40(a, b):
 	return a + b
 
 fo.write("\n/* VCL Methods */\n")
+task = {}
 n = 1
 for i in returns:
 	fo.write(tbl40("#define VCL_MET_%s" % i[0].upper(), "(1U << %d)\n" % n))
+	if not i[1] in task:
+		task[i[1]] = []
+	task[i[1]].append("VCL_MET_" + i[0].upper())
 	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")
+for i in sorted(task.keys()):
+	fo.write(tbl40("#define VCL_MET_TASK_%s" % i.upper(),
+		       "( " + (" | \\\n%42s" % "").join(task[i]) + " )\n"))
+
 
 fo.write("\n/* VCL Returns */\n")
 n = 1


More information about the varnish-commit mailing list