summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-08-10 04:36:30 +0800
committerQuentin Young <qlyoung@qlyoung.net>2023-11-20 20:44:57 -0500
commit2faab06ed3bfad11fceb1108614420c1b9edbd5d (patch)
tree0a0909b4c460cd8d231dc2b66ce598abf071df31
parent83cbdcc2670682db1e6c631e532ec42f05a57d46 (diff)
lib: Add polymorphic noop macro
Co-authored-by: Quentin Young <qlyoung@qlyoung.net> Signed-off-by: Quentin Young <qlyoung@qlyoung.net> Signed-off-by: Donald Lee <dlqs@gmx.com>
-rw-r--r--lib/frrscript.c2
-rw-r--r--lib/frrscript.h13
2 files changed, 8 insertions, 7 deletions
diff --git a/lib/frrscript.c b/lib/frrscript.c
index 50410fb58b..acdd1df67b 100644
--- a/lib/frrscript.c
+++ b/lib/frrscript.c
@@ -25,6 +25,8 @@ DEFINE_MTYPE_STATIC(LIB, SCRIPT, "Scripting");
struct frrscript_names_head frrscript_names_hash;
+void _lua_decode_noop(lua_State *L, ...) {}
+
/*
* Wrapper for frrscript_names_add
* Use this to register hook calls when a daemon starts up
diff --git a/lib/frrscript.h b/lib/frrscript.h
index df49b5718c..a662a808d7 100644
--- a/lib/frrscript.h
+++ b/lib/frrscript.h
@@ -181,6 +181,11 @@ void frrscript_fini(void);
} while (0)
/*
+ * Noop function. Used below where we need a noop decoder for any type.
+ */
+void _lua_decode_noop(lua_State *, ...);
+
+/*
* Maps the type of value to its encoder/decoder.
* Add new mappings here.
*
@@ -220,13 +225,7 @@ struct in6_addr * : lua_decode_in6addr, \
union sockunion * : lua_decode_sockunion, \
char * : lua_decode_stringp, \
struct attr * : lua_decode_attr, \
-struct peer * : lua_decode_noop, \
-const struct prefix * : lua_decode_noop, \
-const struct ipaddr * : lua_decode_noop, \
-const struct ethaddr * : lua_decode_noop, \
-const struct nexthop_group * : lua_decode_noop, \
-const struct nexthop * : lua_decode_noop, \
-struct zebra_dplane_ctx * : lua_decode_noop \
+default : _lua_decode_noop \
)((L), -1, (value))
/*