mesa/main: rework locale setup/teardown

Cc: mesa-stable

Signed-off-by: Thong Thai <thong.thai@amd.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22699>
(cherry picked from commit 7373f25c09)
This commit is contained in:
Thong Thai 2023-04-26 14:57:43 -04:00 committed by Eric Engestrom
parent f24980f741
commit 9ecc019d4d
3 changed files with 12 additions and 5 deletions

View file

@ -958,7 +958,7 @@
"description": "mesa/main: rework locale setup/teardown",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -184,7 +184,6 @@ static void
one_time_fini(void)
{
glsl_type_singleton_decref();
_mesa_locale_fini();
}
/**

View file

@ -35,14 +35,22 @@ static locale_t loc;
#endif
#include "strtod.h"
#include "util/u_call_once.h"
static void
_mesa_locale_init_once(void)
{
#if defined(_GNU_SOURCE) && defined(HAVE_STRTOD_L)
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
atexit(_mesa_locale_fini);
#endif
}
void
_mesa_locale_init(void)
{
#if defined(_GNU_SOURCE) && defined(HAVE_STRTOD_L)
loc = newlocale(LC_CTYPE_MASK, "C", NULL);
#endif
static util_once_flag once = UTIL_ONCE_FLAG_INIT;
util_call_once(&once, _mesa_locale_init_once);
}
void