-/*-
- * 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,
res->size = -(res->size);
}
- rspamd_lua_setclass(L, TENSOR_CLASS, -1);
+ rspamd_lua_setclass(L, rspamd_tensor_classname, -1);
return res;
}
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);
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;
}
-/*-
- * 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,
#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 {