1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-06-30 21:21:45 +02:00

(sos_alloc): Do type-punning through a union to be ANSI-9x compliant

and avoid a warning from gcc.

(Logical change 1.104)
This commit is contained in:
hp.com!davidm 2003-09-25 05:29:14 +00:00
parent 29f2f89a8f
commit 522e2ccbe0

View file

@ -46,6 +46,10 @@ 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;
@ -57,8 +61,9 @@ sos_alloc (size_t size)
mem += size;
if (mem >= sos_memory + sizeof (sos_memory))
abort ();
u.cp = sos_memp;
}
while (cmpxchg_ptr (&sos_memp, old_mem, mem) != old_mem);
while (cmpxchg_ptr (&u.lp, old_mem, mem) != old_mem);
#else
static pthread_mutex_t sos_lock = PTHREAD_MUTEX_INITIALIZER;
sigset_t saved_sigmask;