diff options
| author | Donald Lee <dlqs@gmx.com> | 2021-06-20 08:24:44 +0800 |
|---|---|---|
| committer | Donald Lee <dlqs@gmx.com> | 2021-06-22 04:55:19 +0800 |
| commit | c2642aab24cdbfc7a0b0b203aca9835d52d938ef (patch) | |
| tree | 6f05c6cca4bbfcce91fd982cb497f1e6f5ccc4a6 /lib/frrscript.h | |
| parent | 43a5106d42b6054ca1dbdee7d455a5212c3094ca (diff) | |
lib: Add basic encoders
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/frrscript.h')
| -rw-r--r-- | lib/frrscript.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/frrscript.h b/lib/frrscript.h index 06d247f38d..5410f53e11 100644 --- a/lib/frrscript.h +++ b/lib/frrscript.h @@ -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); |
