BUILD: memory: fix pointer declaration for atomic CAS
The calls to HA_ATOMIC_CAS() on the lockfree version of the pool allocator
were mistakenly done on (void*) for the old value instead of (void **).
While this has no impact on "recent" gcc, it does have one for gcc < 4.7
since the CAS was open coded and it's not possible to assign a temporary
variable of type "void".
No backport is needed, this only affects 1.9.
diff --git a/include/common/memory.h b/include/common/memory.h
index a0b6d62..da96b82 100644
--- a/include/common/memory.h
+++ b/include/common/memory.h
@@ -272,7 +272,7 @@
do {
*POOL_LINK(pool, ptr) = (void *)free_list;
__ha_barrier_store();
- } while (!HA_ATOMIC_CAS(&pool->free_list, (void *)&free_list, ptr));
+ } while (!HA_ATOMIC_CAS(&pool->free_list, (void **)&free_list, ptr));
HA_ATOMIC_SUB(&pool->used, 1);
}
diff --git a/src/memory.c b/src/memory.c
index 51c623a..d75dc7e 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -168,7 +168,7 @@
do {
*POOL_LINK(pool, ptr) = free_list;
__ha_barrier_store();
- } while (HA_ATOMIC_CAS(&pool->free_list, (void *)&free_list, ptr) == 0);
+ } while (HA_ATOMIC_CAS(&pool->free_list, (void **)&free_list, ptr) == 0);
}
HA_ATOMIC_ADD(&pool->allocated, allocated - allocated_orig);
@@ -199,7 +199,7 @@
return;
do {
next = pool->free_list;
- } while (!HA_ATOMIC_CAS(&pool->free_list, (void *)&next, NULL));
+ } while (!HA_ATOMIC_CAS(&pool->free_list, (void **)&next, NULL));
while (next) {
temp = next;
next = *POOL_LINK(pool, temp);