mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
Fix build on uclibc without locale support
When uclibc is build with !UCLIBC_HAS_LOCALE the macro __LOCALE_C_ONLY will be set, use this to disable unsupported and not required(due to only supporting the C locale) locale functions. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
This commit is contained in:
parent
5daa660a62
commit
4738c934bb
1 changed files with 12 additions and 0 deletions
|
|
@ -275,14 +275,20 @@ static inline int spa_scnprintf(char *buffer, size_t size, const char *format, .
|
|||
*/
|
||||
static inline float spa_strtof(const char *str, char **endptr)
|
||||
{
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
static locale_t locale = NULL;
|
||||
locale_t prev;
|
||||
#endif
|
||||
float v;
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
if (SPA_UNLIKELY(locale == NULL))
|
||||
locale = newlocale(LC_ALL_MASK, "C", NULL);
|
||||
prev = uselocale(locale);
|
||||
#endif
|
||||
v = strtof(str, endptr);
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
uselocale(prev);
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
@ -319,14 +325,20 @@ static inline bool spa_atof(const char *str, float *val)
|
|||
*/
|
||||
static inline double spa_strtod(const char *str, char **endptr)
|
||||
{
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
static locale_t locale = NULL;
|
||||
locale_t prev;
|
||||
#endif
|
||||
double v;
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
if (SPA_UNLIKELY(locale == NULL))
|
||||
locale = newlocale(LC_ALL_MASK, "C", NULL);
|
||||
prev = uselocale(locale);
|
||||
#endif
|
||||
v = strtod(str, endptr);
|
||||
#ifndef __LOCALE_C_ONLY
|
||||
uselocale(prev);
|
||||
#endif
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue