mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-03-29 21:50:41 +02:00
Use cairo_init_once functions to get C_locale object
This commit is contained in:
parent
9a5df2f0db
commit
2e65e01d25
1 changed files with 5 additions and 13 deletions
|
|
@ -798,26 +798,18 @@ _cairo_get_locale_decimal_point (void)
|
|||
|
||||
#if defined (HAVE_NEWLOCALE) && defined (HAVE_STRTOD_L)
|
||||
|
||||
static cairo_atomic_once_t C_locale_once;
|
||||
static locale_t C_locale;
|
||||
|
||||
static locale_t
|
||||
get_C_locale (void)
|
||||
{
|
||||
locale_t C;
|
||||
|
||||
retry:
|
||||
C = (locale_t) _cairo_atomic_ptr_get ((cairo_atomic_intptr_t *) &C_locale);
|
||||
|
||||
if (unlikely (!C)) {
|
||||
C = newlocale (LC_ALL_MASK, "C", NULL);
|
||||
|
||||
if (!_cairo_atomic_ptr_cmpxchg ((cairo_atomic_intptr_t *) &C_locale, NULL, C)) {
|
||||
freelocale (C_locale);
|
||||
goto retry;
|
||||
}
|
||||
if (_cairo_atomic_init_once_enter (&C_locale_once)) {
|
||||
C_locale = newlocale (LC_ALL_MASK, "C", NULL);
|
||||
_cairo_atomic_init_once_leave (&C_locale_once);
|
||||
}
|
||||
|
||||
return C;
|
||||
return C_locale;
|
||||
}
|
||||
|
||||
double
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue