aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_redis.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-10-28 23:54:00 +0100
commita47922458216ce76eb5c591096cb8d4bd41f03c3 (patch)
treea5d5b79d030df2e012233999e614d0358f379053 /src/lua/lua_redis.c
parentb2b9cfa6161a98d5d4d074573f99fdac6cb24556 (diff)
downloadrspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.tar.gz
rspamd-a47922458216ce76eb5c591096cb8d4bd41f03c3.zip
[Minor] Further g_slice cleanup
Diffstat (limited to 'src/lua/lua_redis.c')
-rw-r--r--src/lua/lua_redis.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lua/lua_redis.c b/src/lua/lua_redis.c
index c21d69f33..9c5c3fde7 100644
--- a/src/lua/lua_redis.c
+++ b/src/lua/lua_redis.c
@@ -149,11 +149,11 @@ lua_redis_free_args (char **args, gsize *arglens, guint nargs)
if (args) {
for (i = 0; i < nargs; i ++) {
- g_slice_free1 (arglens[i], args[i]);
+ g_free (args[i]);
}
- g_slice_free1 (sizeof (gchar *) * nargs, args);
- g_slice_free1 (sizeof (gsize) * nargs, arglens);
+ g_free (args);
+ g_free (arglens);
}
}
@@ -194,7 +194,7 @@ lua_redis_dtor (struct lua_redis_ctx *ctx)
luaL_unref (ud->L, LUA_REGISTRYINDEX, cur->cbref);
}
- g_slice_free1 (sizeof (*cur), cur);
+ g_free (cur);
}
}
else {
@@ -203,7 +203,7 @@ lua_redis_dtor (struct lua_redis_ctx *ctx)
}
}
- g_slice_free1 (sizeof (*ctx), ctx);
+ g_free (ctx);
}
static gint
@@ -478,10 +478,10 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
lua_pop (L, 1);
}
- args = g_slice_alloc ((top + 1) * sizeof (gchar *));
- arglens = g_slice_alloc ((top + 1) * sizeof (gsize));
+ args = g_malloc ((top + 1) * sizeof (gchar *));
+ arglens = g_malloc ((top + 1) * sizeof (gsize));
arglens[0] = strlen (cmd);
- args[0] = g_slice_alloc (arglens[0]);
+ args[0] = g_malloc (arglens[0]);
memcpy (args[0], cmd, arglens[0]);
top = 1;
lua_pushnil (L);
@@ -493,7 +493,7 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
const gchar *s;
s = lua_tolstring (L, -1, &arglens[top]);
- args[top] = g_slice_alloc (arglens[top]);
+ args[top] = g_malloc (arglens[top]);
memcpy (args[top], s, arglens[top]);
top ++;
}
@@ -504,7 +504,7 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
if (t && t->start) {
arglens[top] = t->len;
- args[top] = g_slice_alloc (arglens[top]);
+ args[top] = g_malloc (arglens[top]);
memcpy (args[top], t->start, arglens[top]);
top ++;
}
@@ -524,7 +524,7 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
}
arglens[top] = r;
- args[top] = g_slice_alloc (arglens[top]);
+ args[top] = g_malloc (arglens[top]);
memcpy (args[top], numbuf, arglens[top]);
top ++;
}
@@ -537,10 +537,10 @@ lua_redis_parse_args (lua_State *L, gint idx, const gchar *cmd,
else {
/* Use merely cmd */
- args = g_slice_alloc (sizeof (gchar *));
- arglens = g_slice_alloc (sizeof (gsize));
+ args = g_malloc (sizeof (gchar *));
+ arglens = g_malloc (sizeof (gsize));
arglens[0] = strlen (cmd);
- args[0] = g_slice_alloc (arglens[0]);
+ args[0] = g_malloc (arglens[0]);
memcpy (args[0], cmd, arglens[0]);
top = 1;
}
@@ -677,7 +677,7 @@ rspamd_lua_redis_prepare_connection (lua_State *L, gint *pcbref)
if (ret && addr != NULL) {
- ctx = g_slice_alloc0 (sizeof (struct lua_redis_ctx));
+ ctx = g_malloc0 (sizeof (struct lua_redis_ctx));
REF_INIT_RETAIN (ctx, lua_redis_dtor);
ctx->flags |= flags | LUA_REDIS_ASYNC;
ud = &ctx->d.async;
@@ -764,7 +764,7 @@ lua_redis_make_request (lua_State *L)
if (ctx) {
ud = &ctx->d.async;
- sp_ud = g_slice_alloc0 (sizeof (*sp_ud));
+ sp_ud = g_malloc0 (sizeof (*sp_ud));
sp_ud->cbref = cbref;
sp_ud->c = ud;
sp_ud->ctx = ctx;
@@ -1083,7 +1083,7 @@ lua_redis_connect_sync (lua_State *L)
if (ret) {
double_to_tv (timeout, &tv);
- ctx = g_slice_alloc0 (sizeof (struct lua_redis_ctx));
+ ctx = g_malloc0 (sizeof (struct lua_redis_ctx));
REF_INIT_RETAIN (ctx, lua_redis_dtor);
ctx->flags = flags;
ctx->d.sync = redisConnectWithTimeout (
@@ -1169,7 +1169,7 @@ lua_redis_add_cmd (lua_State *L)
return luaL_error (L, "invalid arguments");
}
- sp_ud = g_slice_alloc0 (sizeof (*sp_ud));
+ sp_ud = g_malloc0 (sizeof (*sp_ud));
sp_ud->cbref = cbref;
sp_ud->c = &ctx->d.async;
sp_ud->ctx = ctx;