summaryrefslogtreecommitdiff
path: root/lib/frrscript.h
diff options
context:
space:
mode:
authorDonald Lee <dlqs@gmx.com>2021-07-08 02:40:18 +0800
committerDonald Lee <dlqs@gmx.com>2021-07-18 06:32:03 +0800
commitb664092990bddc95562626847396e067d50fae85 (patch)
treeb5bec6e2a16bbf8dea9a62fe5f10a94a14b7ac1a /lib/frrscript.h
parentad6e9b854d64aa91eef2d965b7778188d2d7811a (diff)
lib: standardize zlog error messages
Signed-off-by: Donald Lee <dlqs@gmx.com>
Diffstat (limited to 'lib/frrscript.h')
-rw-r--r--lib/frrscript.h52
1 files changed, 25 insertions, 27 deletions
diff --git a/lib/frrscript.h b/lib/frrscript.h
index 85e7b15cd3..1f234a38a9 100644
--- a/lib/frrscript.h
+++ b/lib/frrscript.h
@@ -192,33 +192,31 @@ int _frrscript_call_lua(struct lua_function_state *lfs, int nargs);
* 0 if the script ran successfully, nonzero otherwise.
*/
-#define frrscript_call(fs, f, ...) \
- ({ \
- struct lua_function_state lookup = {.name = f}; \
- struct lua_function_state *lfs; \
- lfs = hash_lookup(fs->lua_function_hash, &lookup); \
- lfs == NULL ? ({ \
- zlog_err( \
- "Lua script call: tried to call '%s' in '%s' which was not loaded", \
- f, fs->name); \
- 1; \
- }) \
- : ({ \
- MAP_LISTS(ENCODE_ARGS, ##__VA_ARGS__); \
- _frrscript_call_lua( \
- lfs, PP_NARG(__VA_ARGS__)); \
- }) != 0 \
- ? ({ \
- zlog_err( \
- "Lua script call: '%s' in '%s' returned non-zero exit code", \
- f, fs->name); \
- 1; \
- }) \
- : ({ \
- MAP_LISTS(DECODE_ARGS, \
- ##__VA_ARGS__); \
- 0; \
- }); \
+#define frrscript_call(fs, f, ...) \
+ ({ \
+ struct lua_function_state lookup = {.name = f}; \
+ struct lua_function_state *lfs; \
+ lfs = hash_lookup(fs->lua_function_hash, &lookup); \
+ lfs == NULL ? ({ \
+ zlog_err( \
+ "frrscript: '%s.lua': '%s': tried to call this function but it was not loaded", \
+ fs->name, f); \
+ 1; \
+ }) \
+ : ({ \
+ MAP_LISTS(ENCODE_ARGS, ##__VA_ARGS__); \
+ _frrscript_call_lua(lfs, PP_NARG(__VA_ARGS__)); \
+ }) != 0 \
+ ? ({ \
+ zlog_err( \
+ "frrscript: '%s.lua': '%s': this function called but returned non-zero exit code. No variables modified.", \
+ fs->name, f); \
+ 1; \
+ }) \
+ : ({ \
+ MAP_LISTS(DECODE_ARGS, ##__VA_ARGS__); \
+ 0; \
+ }); \
})
/*