From 98f95e6ee435d6ad650ed4c35ef7e1d2864a4b24 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Fri, 5 Dec 2003 06:42:28 +0000 Subject: [PATCH] (sos_alloc): Drop type-cast-avoiding union. If we really need it, it should be done by cmpxchg_ptr(). (Logical change 1.138) --- src/mempool.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/mempool.c b/src/mempool.c index 74380cc5..7cb3eef4 100644 --- a/src/mempool.c +++ b/src/mempool.c @@ -46,14 +46,9 @@ sos_alloc (size_t size) char *mem; #ifdef HAVE_CMPXCHG - union { - long *lp; - char **cp; - } u; char *old_mem; size = (size + MAX_ALIGN - 1) & -MAX_ALIGN; - u.cp = &sos_memp; do { old_mem = sos_memp; @@ -63,7 +58,7 @@ sos_alloc (size_t size) if (mem >= sos_memory + sizeof (sos_memory)) abort (); } - while (!cmpxchg_ptr (u.lp, old_mem, mem)); + while (!cmpxchg_ptr (&sos_memp, old_mem, mem)); #else static pthread_mutex_t sos_lock = PTHREAD_MUTEX_INITIALIZER; sigset_t saved_sigmask;