]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: Add int encoder/decoder
authorDonald Lee <dlqs@gmx.com>
Sat, 17 Jul 2021 12:46:10 +0000 (20:46 +0800)
committerDonald Lee <dlqs@gmx.com>
Sat, 17 Jul 2021 22:32:03 +0000 (06:32 +0800)
Signed-off-by: Donald Lee <dlqs@gmx.com>
lib/frrlua.c
lib/frrlua.h
lib/frrscript.h

index e97e48121c8aba1be0e7f944da18425b4b1e69d5..710d9ece00195cc59acffbea389e548302e7fc6b 100644 (file)
@@ -309,6 +309,14 @@ void lua_decode_noop(lua_State *L, int idx, const void *ptr)
 {
 }
 
+
+/*
+ * Noop decoder for int.
+ */
+void lua_decode_int_noop(lua_State *L, int idx, int i)
+{
+}
+
 /*
  * Logging.
  *
index c4de82740c3c709bc321ef37c64c76e618cd4149..2c86d87cbdda894ab0469c30249d864d614ab0fe 100644 (file)
@@ -162,10 +162,12 @@ void lua_decode_stringp(lua_State *L, int idx, char *str);
 void *lua_tostringp(lua_State *L, int idx);
 
 /*
- * No-op decocder
+ * No-op decocders
  */
 void lua_decode_noop(lua_State *L, int idx, const void *ptr);
 
+void lua_decode_int_noop(lua_State *L, int idx, int i);
+
 /*
  * Retrieve an integer from table on the top of the stack.
  *
index 905cda1a95288362face07b18aa57e0d07a54940..be6820bed57d0b2a5d084c052c7c57001e94cdfc 100644 (file)
@@ -142,6 +142,7 @@ void frrscript_init(const char *scriptdir);
  */
 #define ENCODE_ARGS_WITH_STATE(L, value)                                       \
        _Generic((value), \
+int: lua_pushinteger,                                           \
 long long * : lua_pushintegerp,                                 \
 struct prefix * : lua_pushprefix,                               \
 struct interface * : lua_pushinterface,                         \
@@ -157,6 +158,7 @@ const struct prefix * : lua_pushprefix                          \
 
 #define DECODE_ARGS_WITH_STATE(L, value)                                       \
        _Generic((value), \
+int : lua_decode_int_noop,                                      \
 long long * : lua_decode_integerp,                              \
 struct prefix * : lua_decode_prefix,                            \
 struct interface * : lua_decode_interface,                      \