diff options
| author | Donald Lee <dlqs@gmx.com> | 2021-07-08 02:40:18 +0800 |
|---|---|---|
| committer | Donald Lee <dlqs@gmx.com> | 2021-07-18 06:32:03 +0800 |
| commit | b664092990bddc95562626847396e067d50fae85 (patch) | |
| tree | b5bec6e2a16bbf8dea9a62fe5f10a94a14b7ac1a /lib/frrscript.h | |
| parent | ad6e9b854d64aa91eef2d965b7778188d2d7811a (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.h | 52 |
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; \ + }); \ }) /* |
