mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-27 09:37:38 +01:00
(sos_alloc): Drop type-cast-avoiding union. If we really need it,
it should be done by cmpxchg_ptr(). (Logical change 1.138)
This commit is contained in:
parent
47c25b753c
commit
98f95e6ee4
1 changed files with 1 additions and 6 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue