diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-10-29 12:25:45 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-10-29 12:25:45 +0000 |
commit | 4beb2f2970d709169db316483a6bc547fdcaba8d (patch) | |
tree | 66c3f0e934b8eb4905e408356167bec326ebfa8e /src/libstat | |
parent | a47922458216ce76eb5c591096cb8d4bd41f03c3 (diff) | |
download | rspamd-4beb2f2970d709169db316483a6bc547fdcaba8d.tar.gz rspamd-4beb2f2970d709169db316483a6bc547fdcaba8d.zip |
[Minor] Final stage of g_slice removal
Diffstat (limited to 'src/libstat')
-rw-r--r-- | src/libstat/backends/mmaped_file.c | 12 | ||||
-rw-r--r-- | src/libstat/backends/sqlite3_backend.c | 12 | ||||
-rw-r--r-- | src/libstat/learn_cache/redis_cache.c | 4 | ||||
-rw-r--r-- | src/libstat/learn_cache/sqlite3_cache.c | 6 |
4 files changed, 17 insertions, 17 deletions
diff --git a/src/libstat/backends/mmaped_file.c b/src/libstat/backends/mmaped_file.c index 65ccb5aa1..b3861ca96 100644 --- a/src/libstat/backends/mmaped_file.c +++ b/src/libstat/backends/mmaped_file.c @@ -597,13 +597,13 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, size); } - new_file = g_slice_alloc0 (sizeof (rspamd_mmaped_file_t)); + new_file = g_malloc0 (sizeof (rspamd_mmaped_file_t)); if ((new_file->fd = open (filename, O_RDWR)) == -1) { msg_info_pool ("cannot open file %s, error %d, %s", filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -615,7 +615,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -632,7 +632,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, filename, errno, strerror (errno)); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -640,7 +640,7 @@ rspamd_mmaped_file_open (rspamd_mempool_t *pool, close (new_file->fd); rspamd_file_unlock (new_file->fd, FALSE); munmap (new_file->map, st.st_size); - g_slice_free1 (sizeof (*new_file), new_file); + g_free (new_file); return NULL; } @@ -669,7 +669,7 @@ rspamd_mmaped_file_close_file (rspamd_mempool_t *pool, close (file->fd); } - g_slice_free1 (sizeof (*file), file); + g_free (file); return 0; } diff --git a/src/libstat/backends/sqlite3_backend.c b/src/libstat/backends/sqlite3_backend.c index ec47b06a9..6563d0dc1 100644 --- a/src/libstat/backends/sqlite3_backend.c +++ b/src/libstat/backends/sqlite3_backend.c @@ -437,13 +437,13 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, .tv_nsec = 1000000 }; - bk = g_slice_alloc0 (sizeof (*bk)); + bk = g_malloc0 (sizeof (*bk)); bk->sqlite = rspamd_sqlite3_open_or_create (pool, path, create_tables_sql, 0, err); bk->pool = pool; if (bk->sqlite == NULL) { - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -455,7 +455,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, if (bk->prstmt == NULL) { sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -472,7 +472,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, msg_err_pool ("failed to stard transaction: %d, %s", ret, sqlite3_errmsg (bk->sqlite)); sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); return NULL; } @@ -496,7 +496,7 @@ rspamd_sqlite3_opendb (rspamd_mempool_t *pool, (gint64)strlen (tok_conf_encoded), tok_conf_encoded) != SQLITE_OK) { sqlite3_close (bk->sqlite); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); g_free (tok_conf_encoded); return NULL; @@ -642,7 +642,7 @@ rspamd_sqlite3_close (gpointer p) rspamd_sqlite3_close_prstmt (bk->sqlite, bk->prstmt); sqlite3_close (bk->sqlite); g_free (bk->fname); - g_slice_free1 (sizeof (*bk), bk); + g_free (bk); } } diff --git a/src/libstat/learn_cache/redis_cache.c b/src/libstat/learn_cache/redis_cache.c index 14a90b9d1..b7ba71f4b 100644 --- a/src/libstat/learn_cache/redis_cache.c +++ b/src/libstat/learn_cache/redis_cache.c @@ -302,7 +302,7 @@ rspamd_stat_cache_redis_init (struct rspamd_stat_ctx *ctx, const ucl_object_t *obj; gboolean ret = FALSE; - cache_ctx = g_slice_alloc0 (sizeof (*cache_ctx)); + cache_ctx = g_malloc0 (sizeof (*cache_ctx)); /* First search in backend configuration */ obj = ucl_object_lookup (st->classifier->cfg->opts, "backend"); @@ -344,7 +344,7 @@ rspamd_stat_cache_redis_init (struct rspamd_stat_ctx *ctx, if (!ret) { msg_err_config ("cannot init redis cache for %s", stf->symbol); - g_slice_free1 (sizeof (*cache_ctx), cache_ctx); + g_free (cache_ctx); return NULL; } diff --git a/src/libstat/learn_cache/sqlite3_cache.c b/src/libstat/learn_cache/sqlite3_cache.c index 055950cf4..255c835bb 100644 --- a/src/libstat/learn_cache/sqlite3_cache.c +++ b/src/libstat/learn_cache/sqlite3_cache.c @@ -143,7 +143,7 @@ rspamd_stat_cache_sqlite3_init (struct rspamd_stat_ctx *ctx, err = NULL; } else { - new = g_slice_alloc (sizeof (*new)); + new = g_malloc0 (sizeof (*new)); new->db = sqlite; new->prstmt = rspamd_sqlite3_init_prstmt (sqlite, prepared_stmts, RSPAMD_STAT_CACHE_MAX, &err); @@ -153,7 +153,7 @@ rspamd_stat_cache_sqlite3_init (struct rspamd_stat_ctx *ctx, g_error_free (err); err = NULL; sqlite3_close (sqlite); - g_slice_free1 (sizeof (*new), new); + g_free (new); new = NULL; } } @@ -285,7 +285,7 @@ rspamd_stat_cache_sqlite3_close (gpointer c) if (ctx != NULL) { rspamd_sqlite3_close_prstmt (ctx->db, ctx->prstmt); sqlite3_close (ctx->db); - g_slice_free1 (sizeof (*ctx), ctx); + g_free (ctx); } } |