mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-11-01 12:47:16 +00:00
lib: Add basic encoders
Signed-off-by: Donald Lee <dlqs@gmx.com>
This commit is contained in:
parent
43a5106d42
commit
c2642aab24
@ -98,7 +98,7 @@ void frrscript_init(const char *scriptdir);
|
||||
|
||||
#define ENCODE_ARGS(name, value) \
|
||||
do { \
|
||||
ENCODE_ARGS_WITH_STATE(L, value) \
|
||||
ENCODE_ARGS_WITH_STATE(L, value); \
|
||||
lua_setglobal(L, name); \
|
||||
} while (0)
|
||||
|
||||
@ -108,7 +108,17 @@ void frrscript_init(const char *scriptdir);
|
||||
DECODE_ARGS_WITH_STATE(L, value) \
|
||||
} while (0)
|
||||
|
||||
#define ENCODE_ARGS_WITH_STATE(L, value) _Generic((value), )(L, value);
|
||||
#define ENCODE_ARGS_WITH_STATE(L, value) \
|
||||
_Generic((value), \
|
||||
long long * : lua_pushintegerp, \
|
||||
struct prefix * : lua_pushprefix, \
|
||||
struct interface * : lua_pushinterface, \
|
||||
struct in_addr * : lua_pushinaddr, \
|
||||
struct in6_addr * : lua_pushin6addr, \
|
||||
union sockunion * : lua_pushsockunion, \
|
||||
time_t * : lua_pushtimet, \
|
||||
char * : lua_pushstring_wrapper \
|
||||
)(L, value)
|
||||
|
||||
#define DECODE_ARGS_WITH_STATE(L, value) _Generic((value), )(L, value);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user