mirror of https://github.com/mgba-emu/mgba.git
Util: Check for SETLOCALE too
This commit is contained in:
parent
32cb7bfcdc
commit
d9778a98d4
|
@ -228,6 +228,7 @@ endif()
|
|||
check_function_exists(newlocale HAVE_NEWLOCALE)
|
||||
check_function_exists(freelocale HAVE_FREELOCALE)
|
||||
check_function_exists(uselocale HAVE_USELOCALE)
|
||||
check_function_exists(setlocale HAVE_SETLOCALE)
|
||||
|
||||
if(HAVE_STRDUP)
|
||||
add_definitions(-DHAVE_STRDUP)
|
||||
|
@ -247,6 +248,9 @@ if(HAVE_NEWLOCALE AND HAVE_FREELOCALE AND HAVE_USELOCALE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(HAVE_SETLOCALE)
|
||||
add_definitions(-DHAVE_SETLOCALE)
|
||||
endif()
|
||||
|
||||
# Features
|
||||
set(DEBUGGER_SRC ${CMAKE_SOURCE_DIR}/src/debugger/debugger.c ${CMAKE_SOURCE_DIR}/src/debugger/memory-debugger.c)
|
||||
|
|
|
@ -15,11 +15,14 @@ int ftostr_l(char* restrict str, size_t size, float f, locale_t locale) {
|
|||
int res = snprintf(str, size, "%*.g", FLT_DIG, f);
|
||||
uselocale(old);
|
||||
return res;
|
||||
#else
|
||||
#elif defined(HAVE_SETLOCALE)
|
||||
char* old = setlocale(LC_NUMERIC, locale);
|
||||
int res = snprintf(str, size, "%*.g", FLT_DIG, f);
|
||||
setlocale(LC_NUMERIC, old);
|
||||
return res;
|
||||
#else
|
||||
UNUSED(locale);
|
||||
return snprintf(str, size, "%*.g", FLT_DIG, f);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -30,11 +33,14 @@ float strtof_l(const char* restrict str, char** restrict end, locale_t locale) {
|
|||
float res = strtof(str, end);
|
||||
uselocale(old);
|
||||
return res;
|
||||
#else
|
||||
#elif defined(HAVE_SETLOCALE)
|
||||
char* old = setlocale(LC_NUMERIC, locale);
|
||||
float res = strtof(str, end);
|
||||
setlocale(LC_NUMERIC, old);
|
||||
return res;
|
||||
#else
|
||||
UNUSED(locale);
|
||||
return strtof(str, end);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue