diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-20 15:48:27 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2020-02-20 15:48:27 +0000 |
commit | 0f9f1f8e85a79ce759e92e1c120d51e88b97971f (patch) | |
tree | d1d656bcac16b45b8bd6c977d7c53de99d70f380 /src/lua | |
parent | 73b82b776b5717c4055999b162bf297ae8e66e6c (diff) | |
download | rspamd-0f9f1f8e85a79ce759e92e1c120d51e88b97971f.tar.gz rspamd-0f9f1f8e85a79ce759e92e1c120d51e88b97971f.zip |
[Minor] Add null method to rspamd_text for testing purposes
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_text.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c index 307b2823f..a46fbbe0e 100644 --- a/src/lua/lua_text.c +++ b/src/lua/lua_text.c @@ -34,6 +34,15 @@ * @return {rspamd_text} resulting text */ LUA_FUNCTION_DEF (text, fromstring); + +/** + * @function rspamd_text.null() + * Creates rspamd_text with NULL pointer for testing purposes + * @param {string} str string to use + * @return {rspamd_text} resulting text + */ +LUA_FUNCTION_DEF (text, null); + /** * @function rspamd_text.fromtable(tbl[, delim]) * Same as `table.concat` but generates rspamd_text instead of the Lua string @@ -140,7 +149,10 @@ LUA_FUNCTION_DEF (text, eq); static const struct luaL_reg textlib_f[] = { LUA_INTERFACE_DEF (text, fromstring), + {"from_string", lua_text_fromstring}, LUA_INTERFACE_DEF (text, fromtable), + {"from_table", lua_text_fromtable}, + LUA_INTERFACE_DEF (text, null), {NULL, NULL} }; @@ -230,6 +242,16 @@ lua_text_fromstring (lua_State *L) return 1; } +static gint +lua_text_null (lua_State *L) +{ + LUA_TRACE_POINT; + + lua_new_text (L, NULL, 0, false); + + return 1; +} + #define MAX_REC 10 static void |