aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-03-05 14:44:58 +0000
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-03-05 14:44:58 +0000
commitdd284d1c1ef885d0666656fe3286445a79af0929 (patch)
treee837a3cd7238cb326b37720dd4f45ea0ff7751cb /src
parent900f364e367316e80c2f21bdbadbec540f582e40 (diff)
downloadrspamd-dd284d1c1ef885d0666656fe3286445a79af0929.tar.gz
rspamd-dd284d1c1ef885d0666656fe3286445a79af0929.zip
[Minor] Fix lua_tensor usage
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_tensor.c12
-rw-r--r--src/lua/lua_tensor.h8
2 files changed, 9 insertions, 11 deletions
diff --git a/src/lua/lua_tensor.c b/src/lua/lua_tensor.c
index 75e61392e..d4ee3dcca 100644
--- a/src/lua/lua_tensor.c
+++ b/src/lua/lua_tensor.c
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2020 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,
@@ -96,7 +96,7 @@ lua_newtensor(lua_State *L, int ndims, const int *dim, bool zero_fill, bool own)
res->size = -(res->size);
}
- rspamd_lua_setclass(L, TENSOR_CLASS, -1);
+ rspamd_lua_setclass(L, rspamd_tensor_classname, -1);
return res;
}
@@ -802,7 +802,7 @@ lua_load_tensor(lua_State *L)
void luaopen_tensor(lua_State *L)
{
/* Metatables */
- rspamd_lua_new_class(L, TENSOR_CLASS, rspamd_tensor_m);
+ rspamd_lua_new_class(L, rspamd_tensor_classname, rspamd_tensor_m);
lua_pop(L, 1); /* No need in metatable... */
rspamd_lua_add_preload(L, "rspamd_tensor", lua_load_tensor);
lua_settop(L, 0);
@@ -811,7 +811,7 @@ void luaopen_tensor(lua_State *L)
struct rspamd_lua_tensor *
lua_check_tensor(lua_State *L, int pos)
{
- void *ud = rspamd_lua_check_udata(L, pos, TENSOR_CLASS);
+ void *ud = rspamd_lua_check_udata(L, pos, rspamd_tensor_classname);
luaL_argcheck(L, ud != NULL, pos, "'tensor' expected");
return ud ? ((struct rspamd_lua_tensor *) ud) : NULL;
}
diff --git a/src/lua/lua_tensor.h b/src/lua/lua_tensor.h
index 2103868ae..ffb2517cf 100644
--- a/src/lua/lua_tensor.h
+++ b/src/lua/lua_tensor.h
@@ -1,11 +1,11 @@
-/*-
- * Copyright 2020 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,
@@ -16,8 +16,6 @@
#ifndef RSPAMD_LUA_TENSOR_H
#define RSPAMD_LUA_TENSOR_H
-#define TENSOR_CLASS "rspamd{tensor}"
-
typedef float rspamd_tensor_num_t;
struct rspamd_lua_tensor {