Skip to content

Commit

Permalink
cache: Force slab allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
jfsmig committed Jun 7, 2018
1 parent f1499d2 commit f5ee80b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cache/cache_lru.c
Expand Up @@ -44,7 +44,7 @@ struct oio_cache_s *
oio_cache_make_LRU (struct lru_tree_s *lru)
{
EXTRA_ASSERT (lru != NULL);
struct oio_cache_LRU_s *self = SLICE_NEW0 (struct oio_cache_LRU_s);
struct oio_cache_LRU_s *self = g_slice_new0 (struct oio_cache_LRU_s);
self->vtable = &vtable_LRU;
self->lru = lru;
return (struct oio_cache_s*) self;
Expand All @@ -58,7 +58,7 @@ _lru_destroy (struct oio_cache_s *self)
return;
lru_tree_destroy (l->lru);
l->lru = NULL;
SLICE_FREE (struct oio_cache_LRU_s, l);
g_slice_free (struct oio_cache_LRU_s, l);
}

static enum oio_cache_status_e
Expand Down
10 changes: 5 additions & 5 deletions cache/cache_memcached.c
Expand Up @@ -47,7 +47,7 @@ struct oio_cache_s *
oio_cache_make_memcached (const char *ip, int port)
{
EXTRA_ASSERT (ip != NULL);
struct oio_cache_memcached_s *self = SLICE_NEW0 (struct oio_cache_memcached_s);
struct oio_cache_memcached_s *self = g_slice_new0 (struct oio_cache_memcached_s);
self->vtable = &vtable_memcached;

char *config = g_strdup_printf ("--SERVER=%s:%d", ip, port);
Expand All @@ -62,7 +62,7 @@ oio_cache_make_memcached (const char *ip, int port)
struct oio_cache_s *
oio_cache_make_memcached_config (const char *config)
{
struct oio_cache_memcached_s *self = SLICE_NEW0 (struct oio_cache_memcached_s);
struct oio_cache_memcached_s *self = g_slice_new0 (struct oio_cache_memcached_s);
self->vtable = &vtable_memcached;
self->memc = memcached (config, strlen(config));
if (!self->memc)
Expand All @@ -82,10 +82,10 @@ memcached_parse_status(memcached_return_t rc)

case MEMCACHED_CONNECTION_FAILURE:
return OIO_CACHE_DISCONNECTED;

case MEMCACHED_NOTFOUND:
return OIO_CACHE_NOTFOUND;

case MEMCACHED_TIMEOUT:
return OIO_CACHE_TIMEOUT;

Expand All @@ -104,7 +104,7 @@ _memcached_destroy (struct oio_cache_s *self)
return;
memcached_free (c->memc);
c->memc = NULL;
SLICE_FREE (struct oio_cache_memcached_s, c);
g_slice_free (struct oio_cache_memcached_s, c);
}

static enum oio_cache_status_e
Expand Down
6 changes: 3 additions & 3 deletions cache/cache_multilayer.c
Expand Up @@ -44,7 +44,7 @@ struct oio_cache_s *
oio_cache_make_multilayer (GSList *caches)
{
EXTRA_ASSERT (caches != NULL);
struct oio_cache_multilayer_s *self = SLICE_NEW0 (struct oio_cache_multilayer_s);
struct oio_cache_multilayer_s *self = g_slice_new0 (struct oio_cache_multilayer_s);
self->vtable = &vtable_multilayer;
self->caches = caches;
return (struct oio_cache_s*) self;
Expand All @@ -53,7 +53,7 @@ oio_cache_make_multilayer (GSList *caches)
struct oio_cache_s *
oio_cache_make_multilayer_var (struct oio_cache_s *first, ...)
{
struct oio_cache_multilayer_s *self = SLICE_NEW0 (struct oio_cache_multilayer_s);
struct oio_cache_multilayer_s *self = g_slice_new0 (struct oio_cache_multilayer_s);
self->vtable = &vtable_multilayer;
self->caches = NULL;

Expand All @@ -78,7 +78,7 @@ _multilayer_destroy (struct oio_cache_s *self)
return;
g_slist_free_full (c->caches, (GDestroyNotify) oio_cache_destroy);
c->caches = NULL;
SLICE_FREE (struct oio_cache_multilayer_s, c);
g_slice_free (struct oio_cache_multilayer_s, c);
}

static enum oio_cache_status_e
Expand Down
4 changes: 2 additions & 2 deletions cache/cache_noop.c
Expand Up @@ -30,7 +30,7 @@ struct oio_cache_NOOP_s
static void
_noop_destroy (struct oio_cache_s *self)
{
SLICE_FREE(struct oio_cache_NOOP_s, (struct oio_cache_NOOP_s*) self);
g_slice_free(struct oio_cache_NOOP_s, (struct oio_cache_NOOP_s*) self);
}

static enum oio_cache_status_e
Expand Down Expand Up @@ -64,7 +64,7 @@ static struct oio_cache_vtable_s vtable_NOOP =
struct oio_cache_s *
oio_cache_make_NOOP (void)
{
struct oio_cache_NOOP_s *self = SLICE_NEW0 (struct oio_cache_NOOP_s);
struct oio_cache_NOOP_s *self = g_slice_new0 (struct oio_cache_NOOP_s);
self->vtable = &vtable_NOOP;
return (struct oio_cache_s*) self;
}
4 changes: 2 additions & 2 deletions cache/cache_redis.c
Expand Up @@ -47,7 +47,7 @@ struct oio_cache_s *
oio_cache_make_redis (const char *ip, int port, const struct timeval timeout)
{
EXTRA_ASSERT (ip != NULL);
struct oio_cache_redis_s *self = SLICE_NEW0 (struct oio_cache_redis_s);
struct oio_cache_redis_s *self = g_slice_new0 (struct oio_cache_redis_s);
self->vtable = &vtable_redis;
self->redis = redisConnectWithTimeout (ip, port, timeout);
return (struct oio_cache_s*) self;
Expand Down Expand Up @@ -132,7 +132,7 @@ _redis_destroy (struct oio_cache_s *self)
return;
redisFree (c->redis);
c->redis = NULL;
SLICE_FREE (struct oio_cache_redis_s, c);
g_slice_free (struct oio_cache_redis_s, c);
}

static enum oio_cache_status_e
Expand Down

0 comments on commit f5ee80b

Please sign in to comment.