From: Willy Tarreau Date: Sun, 6 Jun 2010 10:07:32 +0000 (+0200) Subject: [BUILD] memory: add a few missing parenthesis to the pool management macros X-Git-Tag: v1.5-dev8~570 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f8f33284bdba124a5bc54805b820a11fce1ba5c3;p=thirdparty%2Fhaproxy.git [BUILD] memory: add a few missing parenthesis to the pool management macros These missing ones caused a build error when a macro was called with operations as the argument. --- diff --git a/include/common/memory.h b/include/common/memory.h index 765351ce2c..ae483ec73c 100644 --- a/include/common/memory.h +++ b/include/common/memory.h @@ -39,7 +39,7 @@ __p = malloc(((__len) >= sizeof (void *)) ? \ (__len) : sizeof(void *)); \ else { \ - __pool = *(void **)(__pool); \ + (__pool) = *(void **)(__pool); \ } \ __p; \ }) @@ -87,8 +87,8 @@ */ #define pool_free(type, ptr) \ ({ \ - *(void **)ptr = (void *)pool_##type; \ - pool_##type = (void *)ptr; \ + *(void **)(ptr) = (void *)pool_##type; \ + pool_##type = (void *)(ptr); \ }) #else @@ -171,11 +171,11 @@ void *pool_destroy2(struct pool_head *pool); #define pool_alloc2(pool) \ ({ \ void *__p; \ - if ((__p = pool->free_list) == NULL) \ + if ((__p = (pool)->free_list) == NULL) \ __p = pool_refill_alloc(pool); \ else { \ - pool->free_list = *(void **)pool->free_list; \ - pool->used++; \ + (pool)->free_list = *(void **)(pool)->free_list;\ + (pool)->used++; \ } \ __p; \ }) @@ -192,9 +192,9 @@ void *pool_destroy2(struct pool_head *pool); #define pool_free2(pool, ptr) \ ({ \ if (likely((ptr) != NULL)) { \ - *(void **)ptr = (void *)pool->free_list;\ - pool->free_list = (void *)ptr; \ - pool->used--; \ + *(void **)(ptr) = (void *)(pool)->free_list; \ + (pool)->free_list = (void *)(ptr); \ + (pool)->used--; \ } \ })