commit 61d435a: [Minor] Lua_text: Allow to create non owning texts
Vsevolod Stakhov
vsevolod at highsecure.ru
Thu Sep 5 16:35:06 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-09-05 17:29:52 +0100
URL: https://github.com/rspamd/rspamd/commit/61d435a8d120696a280db97bc28ceda3ae6d9781 (HEAD -> master)
[Minor] Lua_text: Allow to create non owning texts
---
src/lua/lua_text.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/lua/lua_text.c b/src/lua/lua_text.c
index 2de05e4b1..a41775230 100644
--- a/src/lua/lua_text.c
+++ b/src/lua/lua_text.c
@@ -139,11 +139,16 @@ lua_text_fromstring (lua_State *L)
LUA_TRACE_POINT;
const gchar *str;
gsize l = 0;
+ gboolean transparent = FALSE;
str = luaL_checklstring (L, 1, &l);
if (str) {
- lua_new_text (L, str, l, RSPAMD_TEXT_FLAG_OWN);
+ if (lua_isboolean (L, 2)) {
+ transparent = lua_toboolean (L, 2);
+ }
+
+ lua_new_text (L, str, l, transparent ? 0 : RSPAMD_TEXT_FLAG_OWN);
}
else {
return luaL_error (L, "invalid arguments");
More information about the Commits
mailing list