From: Vsevolod Stakhov Date: Tue, 5 Mar 2024 13:39:47 +0000 (+0000) Subject: [Project] Start optimization of userdata hashing X-Git-Tag: 3.9.0~109^2~5 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=8238dc0a23a0c654dc25e6debe738ae3321a46ce;p=rspamd.git [Project] Start optimization of userdata hashing --- diff --git a/src/controller.c b/src/controller.c index f05105e91..8df2dc248 100644 --- a/src/controller.c +++ b/src/controller.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,6 +34,7 @@ #include "utlist.h" #include "libmime/lang_detection.h" #include "mempool_vars_internal.h" +#include "lua/lua_classnames.h" #include /* 60 seconds for worker's IO */ @@ -1555,7 +1556,7 @@ rspamd_controller_handle_lua_history(lua_State *L, ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); pconn_ent = lua_newuserdata(L, sizeof(*pconn_ent)); *pconn_ent = conn_ent; rspamd_lua_setclass(L, "rspamd{csession}", -1); @@ -1916,7 +1917,7 @@ rspamd_controller_handle_lua(struct rspamd_http_connection_entry *conn_ent, } ptask = lua_newuserdata(L, sizeof(*ptask)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; pconn = lua_newuserdata(L, sizeof(*pconn)); @@ -3541,7 +3542,7 @@ rspamd_controller_handle_lua_plugin(struct rspamd_http_connection_entry *conn_en /* Task */ ptask = lua_newuserdata(L, sizeof(*ptask)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; /* Connection */ diff --git a/src/libmime/message.c b/src/libmime/message.c index 3acc935e6..84870a8b0 100644 --- a/src/libmime/message.c +++ b/src/libmime/message.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -994,7 +994,7 @@ rspamd_message_from_data(struct rspamd_task *task, const guchar *start, rspamd_lua_setclass(L, "rspamd{mimepart}", -1); *pmime = part; ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; if (lua_pcall(L, 2, 2, 0) != 0) { @@ -1447,7 +1447,7 @@ void rspamd_message_process(struct rspamd_task *task) rspamd_lua_setclass(L, "rspamd{mimepart}", -1); *pmime = part; ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; if (lua_pcall(L, 2, 2, err_idx) != 0) { @@ -1519,7 +1519,7 @@ void rspamd_message_process(struct rspamd_task *task) rspamd_lua_setclass(L, "rspamd{mimepart}", -1); *pmime = part; ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; if (lua_pcall(L, 2, 0, err_idx) != 0) { diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c index a6bc0cb8b..5c89b6560 100644 --- a/src/libmime/scan_result.c +++ b/src/libmime/scan_result.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -566,7 +566,7 @@ rspamd_task_insert_result_full(struct rspamd_task *task, if (!rspamd_lua_universal_pcall(L, mres->symbol_cbref, G_STRLOC, 1, "uss", &err, - "rspamd{task}", task, symbol, mres->name ? mres->name : "default")) { + rspamd_task_classname, task, symbol, mres->name ? mres->name : "default")) { msg_warn_task("cannot call for symbol_cbref for result %s: %e", mres->name ? mres->name : "default", err); g_error_free(err); diff --git a/src/libserver/protocol.c b/src/libserver/protocol.c index 867455754..37a41c111 100644 --- a/src/libserver/protocol.c +++ b/src/libserver/protocol.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ #include "libserver/mempool_vars_internal.h" #include "contrib/fastutf8/fastutf8.h" #include "task.h" +#include "lua/lua_classnames.h" #include #ifdef SYS_ZSTD @@ -1923,7 +1924,7 @@ void rspamd_protocol_write_log_pipe(struct rspamd_task *task) if (lua_isfunction(L, -1)) { ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); /* stack: * -1: task * -2: func diff --git a/src/libserver/re_cache.c b/src/libserver/re_cache.c index d51dba647..15a52228b 100644 --- a/src/libserver/re_cache.c +++ b/src/libserver/re_cache.c @@ -25,6 +25,7 @@ #include "lua/lua_common.h" #include "libstat/stat_api.h" #include "contrib/uthash/utlist.h" +#include "lua/lua_classnames.h" #include "khash.h" @@ -562,7 +563,7 @@ rspamd_re_cache_check_lua_condition(struct rspamd_task *task, if (!rspamd_lua_universal_pcall(L, lua_cbref, G_STRLOC, 1, "utii", &err, - "rspamd{task}", task, + rspamd_task_classname, task, text_pos, start, end)) { msg_warn_task("cannot call for re_cache_check_lua_condition for re %s: %e", rspamd_regexp_get_pattern(re), err); @@ -908,7 +909,7 @@ rspamd_re_cache_process_selector(struct rspamd_task *task, lua_rawgeti(L, LUA_REGISTRYINDEX, ref); ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if ((ret = lua_pcall(L, 1, 1, err_idx)) != 0) { msg_err_task("call to selector %s " diff --git a/src/libserver/task.c b/src/libserver/task.c index 9763d1eb4..4518477fc 100644 --- a/src/libserver/task.c +++ b/src/libserver/task.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,7 @@ #include "libserver/cfg_file_private.h" #include "libmime/lang_detection.h" #include "libmime/scan_result_private.h" +#include "lua/lua_classnames.h" #ifdef WITH_JEMALLOC #include @@ -1616,7 +1617,7 @@ void rspamd_task_write_log(struct rspamd_task *task) L = task->cfg->lua_state; lua_rawgeti(L, LUA_REGISTRYINDEX, GPOINTER_TO_INT(lf->data)); ptask = lua_newuserdata(L, sizeof(*ptask)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; if (lua_pcall(L, 1, 1, 0) != 0) { diff --git a/src/libstat/backends/redis_backend.cxx b/src/libstat/backends/redis_backend.cxx index 14e821029..9cc0b123d 100644 --- a/src/libstat/backends/redis_backend.cxx +++ b/src/libstat/backends/redis_backend.cxx @@ -218,7 +218,7 @@ gsize rspamd_redis_expand_object(const gchar *pattern, lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->cbref_user); ptask = (struct rspamd_task **) lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_pcall(L, 1, 1, err_idx) != 0) { msg_err_task("call to user extraction script failed: %s", diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index 2fd34d83f..68b52128f 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -1,11 +1,11 @@ -/*- - * Copyright 2016 Vsevolod Stakhov +/* + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -177,7 +177,7 @@ rspamd_sqlite3_get_user(struct rspamd_stat_sqlite3_db *db, lua_rawgeti(L, LUA_REGISTRYINDEX, db->cbref_user); ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_pcall(L, 1, 1, err_idx) != 0) { msg_err_task("call to user extraction script failed: %s", @@ -246,7 +246,7 @@ rspamd_sqlite3_get_language(struct rspamd_stat_sqlite3_db *db, lua_rawgeti(L, LUA_REGISTRYINDEX, db->cbref_language); ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_pcall(L, 1, 1, err_idx) != 0) { msg_err_task("call to language extraction script failed: %s", diff --git a/src/libstat/classifiers/lua_classifier.c b/src/libstat/classifiers/lua_classifier.c index b74330dca..09b35c6a9 100644 --- a/src/libstat/classifiers/lua_classifier.c +++ b/src/libstat/classifiers/lua_classifier.c @@ -1,11 +1,11 @@ -/*- - * Copyright 2016 Vsevolod Stakhov +/* + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -145,7 +145,7 @@ lua_classifier_classify(struct rspamd_classifier *cl, lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->classify_ref); ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); pcfg = lua_newuserdata(L, sizeof(*pcfg)); *pcfg = cl->cfg; rspamd_lua_setclass(L, "rspamd{classifier}", -1); @@ -200,7 +200,7 @@ lua_classifier_learn_spam(struct rspamd_classifier *cl, lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->learn_ref); ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); pcfg = lua_newuserdata(L, sizeof(*pcfg)); *pcfg = cl->cfg; rspamd_lua_setclass(L, "rspamd{classifier}", -1); diff --git a/src/libstat/stat_process.c b/src/libstat/stat_process.c index 8c1d8ff19..c1d194694 100644 --- a/src/libstat/stat_process.c +++ b/src/libstat/stat_process.c @@ -1,11 +1,11 @@ -/*- - * Copyright 2016 Vsevolod Stakhov +/* + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, @@ -21,6 +21,7 @@ #include "libmime/images.h" #include "libserver/html/html.h" #include "lua/lua_common.h" +#include "lua/lua_classnames.h" #include "libserver/mempool_vars_internal.h" #include "utlist.h" #include @@ -54,7 +55,7 @@ rspamd_stat_tokenize_parts_metadata(struct rspamd_stat_ctx *st_ctx, ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if ((ret = lua_pcall(L, 1, 1, err_idx)) != 0) { msg_err_task("call to stat_tokens lua " @@ -210,7 +211,7 @@ rspamd_stat_classifier_is_skipped(struct rspamd_task *task, /* Push task and two booleans: is_spam and is_unlearn */ struct rspamd_task **ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (is_learn) { lua_pushboolean(L, is_spam); @@ -1063,7 +1064,7 @@ rspamd_stat_check_autolearn(struct rspamd_task *task) ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_pcall(L, 1, 1, err_idx) != 0) { msg_err_task("call to autolearn script failed: " @@ -1118,7 +1119,7 @@ rspamd_stat_check_autolearn(struct rspamd_task *task) ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); /* Push the whole object as well */ ucl_object_push_lua(L, obj, true); diff --git a/src/lua/CMakeLists.txt b/src/lua/CMakeLists.txt index a504f99f8..46de053ba 100644 --- a/src/lua/CMakeLists.txt +++ b/src/lua/CMakeLists.txt @@ -34,6 +34,7 @@ SET(LUASRC ${CMAKE_CURRENT_SOURCE_DIR}/lua_common.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_spf.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_tensor.c ${CMAKE_CURRENT_SOURCE_DIR}/lua_parsers.c - ${CMAKE_CURRENT_SOURCE_DIR}/lua_compress.c) + ${CMAKE_CURRENT_SOURCE_DIR}/lua_compress.c + ${CMAKE_CURRENT_SOURCE_DIR}/lua_classnames.c) SET(RSPAMD_LUA ${LUASRC} PARENT_SCOPE) \ No newline at end of file diff --git a/src/lua/lua_common.h b/src/lua/lua_common.h index cc2b94390..b46c0bfc9 100644 --- a/src/lua/lua_common.h +++ b/src/lua/lua_common.h @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ #include "config.h" + /* Lua headers do not have __cplusplus guards... */ #ifdef __cplusplus extern "C" { @@ -40,6 +41,7 @@ extern "C" { #include "rspamd.h" #include "ucl.h" #include "lua_ucl.h" +#include "lua_classnames.h" #ifdef __cplusplus extern "C" { diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index a044827a7..5e3eacd29 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1242,7 +1242,7 @@ lua_metric_symbol_callback(struct rspamd_task *task, } ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; if ((ret = lua_pcall(L, 1, LUA_MULTRET, err_idx)) != 0) { @@ -1382,7 +1382,7 @@ lua_metric_symbol_callback_coro(struct rspamd_task *task, } ptask = lua_newuserdata(thread, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(thread, "rspamd{task}", -1); + rspamd_lua_setclass(thread, rspamd_task_classname, -1); *ptask = task; thread_entry->finish_callback = lua_metric_symbol_callback_return; @@ -4773,7 +4773,7 @@ void lua_call_finish_script(struct rspamd_config_cfg_lua_script *sc, lua_rawgeti(L, LUA_REGISTRYINDEX, sc->cbref); ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; lua_thread_call(thread, 1); diff --git a/src/lua/lua_logger.c b/src/lua/lua_logger.c index f4f8f3dbf..b9969b86b 100644 --- a/src/lua/lua_logger.c +++ b/src/lua/lua_logger.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -653,7 +653,7 @@ lua_logger_get_id(lua_State *L, gint pos, GError **err) clsname = lua_tostring(L, -1); - if (strcmp(clsname, "rspamd{task}") == 0) { + if (strcmp(clsname, rspamd_task_classname) == 0) { struct rspamd_task *task = lua_check_task(L, pos); if (task) { diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index dd2ca108b..79cf9c55e 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1382,7 +1382,7 @@ static const struct luaL_reg archivelib_m[] = { struct rspamd_task * lua_check_task(lua_State *L, gint pos) { - void *ud = rspamd_lua_check_udata(L, pos, "rspamd{task}"); + void *ud = rspamd_lua_check_udata(L, pos, rspamd_task_classname); luaL_argcheck(L, ud != NULL, pos, "'task' expected"); return ud ? *((struct rspamd_task **) ud) : NULL; } @@ -1390,7 +1390,7 @@ lua_check_task(lua_State *L, gint pos) struct rspamd_task * lua_check_task_maybe(lua_State *L, gint pos) { - void *ud = rspamd_lua_check_udata_maybe(L, pos, "rspamd{task}"); + void *ud = rspamd_lua_check_udata_maybe(L, pos, rspamd_task_classname); return ud ? *((struct rspamd_task **) ud) : NULL; } @@ -1781,7 +1781,7 @@ lua_task_load_from_file(lua_State *L) if (res) { ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); } else { if (err) { @@ -1832,7 +1832,7 @@ lua_task_load_from_string(lua_State *L) ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); return 2; } @@ -1868,7 +1868,7 @@ lua_task_create(lua_State *L) ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); return 1; } @@ -7271,7 +7271,7 @@ luaopen_archive(lua_State *L) void luaopen_task(lua_State *L) { - rspamd_lua_new_class(L, "rspamd{task}", tasklib_m); + rspamd_lua_new_class(L, rspamd_task_classname, tasklib_m); lua_pop(L, 1); rspamd_lua_add_preload(L, "rspamd_task", lua_load_task); @@ -7290,6 +7290,6 @@ void rspamd_lua_task_push(lua_State *L, struct rspamd_task *task) struct rspamd_task **ptask; ptask = lua_newuserdata(L, sizeof(gpointer)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; } diff --git a/src/plugins/fuzzy_check.c b/src/plugins/fuzzy_check.c index 85db83d08..581c1c12d 100644 --- a/src/plugins/fuzzy_check.c +++ b/src/plugins/fuzzy_check.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1566,7 +1566,7 @@ fuzzy_rule_check_mimepart(struct rspamd_task *task, ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); ppart = lua_newuserdata(L, sizeof(*ppart)); *ppart = part; @@ -3510,7 +3510,7 @@ fuzzy_process_handler(struct rspamd_http_connection_entry *conn_ent, lua_rawgeti(L, LUA_REGISTRYINDEX, rule->learn_condition_cb); ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_pcall(L, 1, LUA_MULTRET, err_idx) != 0) { msg_err_task("call to fuzzy learn condition failed: %s", diff --git a/src/plugins/regexp.c b/src/plugins/regexp.c index 59a84c507..83d2fc963 100644 --- a/src/plugins/regexp.c +++ b/src/plugins/regexp.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -475,7 +475,7 @@ rspamd_lua_call_expression_func(struct ucl_lua_funcdata *lua_data, lua_rawgeti(L, LUA_REGISTRYINDEX, lua_data->idx); /* Now we got function in top of stack */ ptask = lua_newuserdata(L, sizeof(struct rspamd_task *)); - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); *ptask = task; /* Now push all arguments */ diff --git a/src/rspamadm/lua_repl.c b/src/rspamadm/lua_repl.c index 432c4de76..d3f32c9db 100644 --- a/src/rspamadm/lua_repl.c +++ b/src/rspamadm/lua_repl.c @@ -1,5 +1,5 @@ /* - * Copyright 2023 Vsevolod Stakhov + * Copyright 2024 Vsevolod Stakhov * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -448,7 +448,7 @@ rspamadm_lua_message_handler(lua_State *L, gint argc, gchar **argv) lua_pushvalue(L, func_idx); ptask = lua_newuserdata(L, sizeof(*ptask)); *ptask = task; - rspamd_lua_setclass(L, "rspamd{task}", -1); + rspamd_lua_setclass(L, rspamd_task_classname, -1); if (lua_repl_thread_call(thread, 1, argv[i], lua_thread_str_error_cb) == 0) {