char subname[DATA_MAX_NAME_LEN];
if (!lua_isfunction(L, 1) && lua_isstring(L, 1)) {
const char *fname = lua_tostring(L, 1);
- snprintf(subname, sizeof(subname), "%s()", fname);
+ ssnprintf(subname, sizeof(subname), "%s()", fname);
lua_getglobal(L, fname); // Push function into stack
lua_remove(L, 1); // Remove string from stack
} else {
lua_getfield(L, LUA_REGISTRYINDEX, "collectd:callback_num");
int tmp = lua_tointeger(L, -1);
- snprintf(subname, sizeof(subname), "callback_%d", tmp);
+ ssnprintf(subname, sizeof(subname), "callback_%d", tmp);
lua_pop(L, 1); // Remove old value from stack
lua_pushinteger(L, tmp + 1);
lua_setfield(L, LUA_REGISTRYINDEX, "collectd:callback_num"); // pops value
lua_getfield(L, LUA_REGISTRYINDEX, "collectd:script_path");
char function_name[DATA_MAX_NAME_LEN];
- snprintf(function_name, sizeof(function_name), "lua/%s/%s",
- lua_tostring(L, -1), subname);
+ ssnprintf(function_name, sizeof(function_name), "lua/%s/%s",
+ lua_tostring(L, -1), subname);
lua_pop(L, 1);
int callback_id = clua_store_callback(L, 1);
pthread_mutex_init(&cb->lock, NULL);
if (PLUGIN_READ == type) {
- int status =
- plugin_register_complex_read(/* group = */ "lua",
- /* name = */ function_name,
- /* callback = */ clua_read,
- /* interval = */ 0,
- &(user_data_t){
- .data = cb, .free_func = lua_cb_free,
- });
+ int status = plugin_register_complex_read(/* group = */ "lua",
+ /* name = */ function_name,
+ /* callback = */ clua_read,
+ /* interval = */ 0,
+ &(user_data_t){
+ .data = cb,
+ .free_func = lua_cb_free,
+ });
if (status != 0)
return luaL_error(L, "%s", "plugin_register_complex_read failed");
int status = plugin_register_write(/* name = */ function_name,
/* callback = */ clua_write,
&(user_data_t){
- .data = cb, .free_func = lua_cb_free,
+ .data = cb,
+ .free_func = lua_cb_free,
});
if (status != 0)
if (base_path[0] == '\0')
sstrncpy(abs_path, rel_path, sizeof(abs_path));
else
- snprintf(abs_path, sizeof(abs_path), "%s/%s", base_path, rel_path);
+ ssnprintf(abs_path, sizeof(abs_path), "%s/%s", base_path, rel_path);
DEBUG("Lua plugin: abs_path = \"%s\";", abs_path);