Fix a strict aliasing violation.
This commit is contained in:
parent
828d919b5e
commit
56af64dc19
@ -89,7 +89,12 @@ chunk_hooks_set(arena_t *arena, const chunk_hooks_t *chunk_hooks)
|
|||||||
* correctness, so they perform unlocked reads.
|
* correctness, so they perform unlocked reads.
|
||||||
*/
|
*/
|
||||||
#define ATOMIC_COPY_HOOK(n) do { \
|
#define ATOMIC_COPY_HOOK(n) do { \
|
||||||
atomic_write_p((void **)&arena->chunk_hooks.n, chunk_hooks->n); \
|
union { \
|
||||||
|
chunk_##n##_t **n; \
|
||||||
|
void **v; \
|
||||||
|
} u; \
|
||||||
|
u.n = &arena->chunk_hooks.n; \
|
||||||
|
atomic_write_p(u.v, chunk_hooks->n); \
|
||||||
} while (0)
|
} while (0)
|
||||||
ATOMIC_COPY_HOOK(alloc);
|
ATOMIC_COPY_HOOK(alloc);
|
||||||
ATOMIC_COPY_HOOK(dalloc);
|
ATOMIC_COPY_HOOK(dalloc);
|
||||||
|
Loading…
Reference in New Issue
Block a user