Andrew Geissler | 78b7279 | 2022-06-14 06:47:25 -0500 | [diff] [blame] | 1 | From d3ea3142e1a4de206e616bc18f63a529e6b4986a Mon Sep 17 00:00:00 2001 |
| 2 | From: psykose <alice@ayaya.dev> |
| 3 | Date: Wed, 13 Apr 2022 21:57:49 +0000 |
| 4 | Subject: [PATCH 001/154] spa: fix c90 header include |
| 5 | |
| 6 | placing declarations after code is invalid under ISO c90 |
| 7 | |
| 8 | Fixes !1211 |
| 9 | |
| 10 | Patch-Status: Backport |
| 11 | --- |
| 12 | spa/include/spa/utils/string.h | 6 ++++-- |
| 13 | 1 file changed, 4 insertions(+), 2 deletions(-) |
| 14 | |
| 15 | diff --git a/spa/include/spa/utils/string.h b/spa/include/spa/utils/string.h |
| 16 | index e80434537..43d19616c 100644 |
| 17 | --- a/spa/include/spa/utils/string.h |
| 18 | +++ b/spa/include/spa/utils/string.h |
| 19 | @@ -276,10 +276,11 @@ static inline int spa_scnprintf(char *buffer, size_t size, const char *format, . |
| 20 | static inline float spa_strtof(const char *str, char **endptr) |
| 21 | { |
| 22 | static locale_t locale = NULL; |
| 23 | + locale_t prev; |
| 24 | float v; |
| 25 | if (SPA_UNLIKELY(locale == NULL)) |
| 26 | locale = newlocale(LC_ALL_MASK, "C", NULL); |
| 27 | - locale_t prev = uselocale(locale); |
| 28 | + prev = uselocale(locale); |
| 29 | v = strtof(str, endptr); |
| 30 | uselocale(prev); |
| 31 | return v; |
| 32 | @@ -319,10 +320,11 @@ static inline bool spa_atof(const char *str, float *val) |
| 33 | static inline double spa_strtod(const char *str, char **endptr) |
| 34 | { |
| 35 | static locale_t locale = NULL; |
| 36 | + locale_t prev; |
| 37 | double v; |
| 38 | if (SPA_UNLIKELY(locale == NULL)) |
| 39 | locale = newlocale(LC_ALL_MASK, "C", NULL); |
| 40 | - locale_t prev = uselocale(locale); |
| 41 | + prev = uselocale(locale); |
| 42 | v = strtod(str, endptr); |
| 43 | uselocale(prev); |
| 44 | return v; |
| 45 | -- |
| 46 | 2.25.1 |
| 47 | |