From 1d5a96e14673835b76f339ce39e3728f8c9d6867 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Sun, 14 Jun 2015 13:56:43 -0400 Subject: [PATCH] Remove useless checks. --- src/libutil/mem_pool.c | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/libutil/mem_pool.c b/src/libutil/mem_pool.c index 7927fdace..81487e49c 100644 --- a/src/libutil/mem_pool.c +++ b/src/libutil/mem_pool.c @@ -80,19 +80,7 @@ pool_chain_new (gsize size) g_return_val_if_fail (size > 0, NULL); chain = g_slice_alloc (sizeof (struct _pool_chain)); - - if (chain == NULL) { - msg_err ("cannot allocate %z bytes, aborting", - sizeof (struct _pool_chain)); - abort (); - } - chain->begin = g_slice_alloc (size); - if (chain->begin == NULL) { - msg_err ("cannot allocate %z bytes, aborting", size); - abort (); - } - chain->pos = align_ptr (chain->begin, MEM_ALIGNMENT); chain->len = size; chain->next = NULL; @@ -117,7 +105,7 @@ pool_chain_new_shared (gsize size) -1, 0); if (map == MAP_FAILED) { - msg_err ("cannot allocate %z bytes, aborting", size + + msg_err ("cannot allocate %z bytes of shared memory, aborting", size + sizeof (struct _pool_chain)); abort (); } @@ -220,12 +208,6 @@ rspamd_mempool_new (gsize size) } new = g_slice_alloc (sizeof (rspamd_mempool_t)); - if (new == NULL) { - msg_err ("cannot allocate %z bytes, aborting", - sizeof (rspamd_mempool_t)); - abort (); - } - new->cur_pool = pool_chain_new (size); new->shared_pool = NULL; new->cur_pool_tmp = NULL; @@ -233,7 +215,6 @@ rspamd_mempool_new (gsize size) /* Set it upon first call of set variable */ new->variables = NULL; new->elt_len = size; - mem_pool_stat->pools_allocated++; return new; -- 2.39.5