[master] 134212c28 Turn the PARAM() macro into a vararg

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Mar 2 14:09:08 UTC 2020


commit 134212c28475c6c3ac36e411fef3efcbc6feae25
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Mon Mar 2 11:27:54 2020 +0100

    Turn the PARAM() macro into a vararg
    
    The two places where the parameters table is used have very distinct
    needs, and even among parameters themselves we will need some degree
    variation.

diff --git a/bin/varnishd/common/common_param.h b/bin/varnishd/common/common_param.h
index 0fdeaaefd..6d1630c2e 100644
--- a/bin/varnishd/common/common_param.h
+++ b/bin/varnishd/common/common_param.h
@@ -82,7 +82,8 @@ struct params {
 #define	ptyp_uint	unsigned
 #define	ptyp_vsl_buffer	unsigned
 #define	ptyp_vsl_reclen	unsigned
-#define PARAM(nm, ty, mi, ma, de, un, fl, st) ptyp_##ty nm;
+#define PARAM(nm, ty, ...)		\
+	ptyp_##ty		nm;
 #include <tbl/params.h>
 #undef ptyp_bool
 #undef ptyp_bytes
diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c
index 4f417cd76..09bff349a 100644
--- a/bin/varnishd/mgt/mgt_param_tbl.c
+++ b/bin/varnishd/mgt/mgt_param_tbl.c
@@ -45,8 +45,9 @@
 	"\tmax_age\tmax age of free element."
 
 struct parspec mgt_parspec[] = {
-#define PARAM(nm, ty, mi, ma, de, un, fl, st)				\
-	{ #nm, tweak_##ty, &mgt_param.nm, mi, ma, st, fl, de, un },
+#define PARAM(nm, ty, mi, ma, de, un, fl, st, ...)			\
+	{ #nm, tweak_##ty, &mgt_param.nm, mi, ma, st, fl, de, un,	\
+	    __VA_ARGS__ },
 #include "tbl/params.h"
 
 	{ "cc_command", tweak_string, &mgt_cc_cmd,
diff --git a/include/tbl/params.h b/include/tbl/params.h
index db734ffcb..63492f9f3 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -27,7 +27,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * PARAM(nm, ty, mi, ma, de, un, fl, st)
+ * PARAM(nm, ty, mi, ma, de, un, fl, st[, dyn_min_reason, dyn_max_reason])
  */
 
 /*lint -save -e525 -e539 */


More information about the varnish-commit mailing list