From: Vsevolod Stakhov Date: Thu, 5 Sep 2019 16:29:52 +0000 (+0100) Subject: [Minor] Lua_text: Allow to create non owning texts X-Git-Tag: 2.0~272 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=61d435a8d120696a280db97bc28ceda3ae6d9781;p=rspamd.git [Minor] Lua_text: Allow to create non owning texts --- 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");