spa: fix c90 header include

placing declarations after code is invalid under ISO c90

Fixes !1211
This commit is contained in:
psykose 2022-04-13 21:57:49 +00:00 committed by Wim Taymans
parent b0dcfa886d
commit d3ea3142e1

View file

@ -276,10 +276,11 @@ static inline int spa_scnprintf(char *buffer, size_t size, const char *format, .
static inline float spa_strtof(const char *str, char **endptr) static inline float spa_strtof(const char *str, char **endptr)
{ {
static locale_t locale = NULL; static locale_t locale = NULL;
locale_t prev;
float v; float v;
if (SPA_UNLIKELY(locale == NULL)) if (SPA_UNLIKELY(locale == NULL))
locale = newlocale(LC_ALL_MASK, "C", NULL); locale = newlocale(LC_ALL_MASK, "C", NULL);
locale_t prev = uselocale(locale); prev = uselocale(locale);
v = strtof(str, endptr); v = strtof(str, endptr);
uselocale(prev); uselocale(prev);
return v; return v;
@ -319,10 +320,11 @@ static inline bool spa_atof(const char *str, float *val)
static inline double spa_strtod(const char *str, char **endptr) static inline double spa_strtod(const char *str, char **endptr)
{ {
static locale_t locale = NULL; static locale_t locale = NULL;
locale_t prev;
double v; double v;
if (SPA_UNLIKELY(locale == NULL)) if (SPA_UNLIKELY(locale == NULL))
locale = newlocale(LC_ALL_MASK, "C", NULL); locale = newlocale(LC_ALL_MASK, "C", NULL);
locale_t prev = uselocale(locale); prev = uselocale(locale);
v = strtod(str, endptr); v = strtod(str, endptr);
uselocale(prev); uselocale(prev);
return v; return v;