Skip to content

Commit 2766c37

Browse files
committed
mem: fix warnings when F_PARALLEL_MALLOC is not defined
1 parent bb2423b commit 2766c37

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

mem/shm_mem.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ gen_lock_t *mem_lock;
102102

103103
#if defined F_PARALLEL_MALLOC
104104
gen_lock_t *hash_locks[TOTAL_F_PARALLEL_POOLS];
105+
/* we allocated TOTAL_F_PARALLEL_POOLS mem blocks */
106+
static void** shm_mempools=NULL;
107+
void **shm_blocks;
105108
#endif
106109

107110
#ifdef HP_MALLOC
@@ -111,10 +114,6 @@ gen_lock_t *mem_locks;
111114
static void* shm_mempool=INVALID_MAP;
112115
void *shm_block;
113116

114-
/* we allocated TOTAL_F_PARALLEL_POOLS mem blocks */
115-
static void** shm_mempools=NULL;
116-
void **shm_blocks;
117-
118117
int init_done=0;
119118

120119
#ifdef DBG_MALLOC
@@ -557,7 +556,9 @@ int shm_mem_init_mallocs(void* mempool, unsigned long pool_size,int idx)
557556

558557
if (mem_allocator_shm != MM_F_PARALLEL_MALLOC && mem_allocator_shm != MM_F_PARALLEL_MALLOC_DBG) {
559558
if (!shm_block){
559+
#ifdef F_PARALLEL_MALLOC
560560
err_destroy:
561+
#endif
561562
LM_CRIT("could not initialize shared malloc\n");
562563
shm_mem_destroy();
563564
return -1;
@@ -764,8 +765,7 @@ int shm_dbg_mem_init_mallocs(void* mempool, unsigned long pool_size)
764765

765766
int shm_mem_init(void)
766767
{
767-
int fd = -1,i=0;
768-
unsigned long block_size;
768+
int fd = -1;
769769
LM_INFO("allocating SHM block\n");
770770

771771
#ifdef SHM_MMAP
@@ -808,8 +808,10 @@ int shm_mem_init(void)
808808
#ifdef F_PARALLEL_MALLOC
809809
if (mem_allocator_shm == MM_F_PARALLEL_MALLOC ||
810810
mem_allocator_shm == MM_F_PARALLEL_MALLOC_DBG) {
811+
int i;
811812
LM_DBG("Paralel malloc, total pools size is %d\n",TOTAL_F_PARALLEL_POOLS);
812813
for (i=0;i<TOTAL_F_PARALLEL_POOLS;i++) {
814+
unsigned long block_size;
813815

814816
block_size = shm_mem_size/TOTAL_F_PARALLEL_POOLS;
815817
shm_mempools[i] = shm_getmem(fd,NULL,block_size);

0 commit comments

Comments
 (0)