glib: fix g_ascii_formatd indirectly.
This makes it so we use snprintf instead of their fallback float formatting code, which fixes asserts caused by pango 1.5.0.
This commit is contained in:
parent
30d9d25aad
commit
f0f6c7e8aa
|
@ -0,0 +1,86 @@
|
||||||
|
From: =?UTF-8?q?=C3=89rico=20Nogueira?= <erico.erc@gmail.com>
|
||||||
|
[PATCH] gstrfuncs: don't require nonstandard functions for USE_XLOCALE.
|
||||||
|
|
||||||
|
Make it so USE_XLOCALE is set whenever newlocale() and uselocale() are
|
||||||
|
available. This way, we can still use the _g_snprintf() path for some
|
||||||
|
functions, and also use the *_l functions when they are available.
|
||||||
|
|
||||||
|
newlocale(3) are uselocale(3) part of POSIX 2008, while the *_l
|
||||||
|
functions being used are nonstandard glibc extensions. Gating all the
|
||||||
|
locale functionality behind them meant we were using fallbacks on non
|
||||||
|
glibc platforms unnecessarily.
|
||||||
|
|
||||||
|
Further changes to this code could add fallback for the non _l suffixed
|
||||||
|
number parsing functions, but that might be unnecessary complexity.
|
||||||
|
|
||||||
|
Fixes #2553
|
||||||
|
---
|
||||||
|
glib/gstrfuncs.c | 17 +++++++----------
|
||||||
|
1 file changed, 7 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/glib/gstrfuncs.c b/glib/gstrfuncs.c
|
||||||
|
index ea710c7a1..e486251ab 100644
|
||||||
|
--- a/glib/gstrfuncs.c
|
||||||
|
+++ b/glib/gstrfuncs.c
|
||||||
|
@@ -317,11 +317,8 @@ static const guint16 ascii_table_data[256] = {
|
||||||
|
|
||||||
|
const guint16 * const g_ascii_table = ascii_table_data;
|
||||||
|
|
||||||
|
-#if defined (HAVE_NEWLOCALE) && \
|
||||||
|
- defined (HAVE_USELOCALE) && \
|
||||||
|
- defined (HAVE_STRTOD_L) && \
|
||||||
|
- defined (HAVE_STRTOULL_L) && \
|
||||||
|
- defined (HAVE_STRTOLL_L)
|
||||||
|
+#if defined(HAVE_NEWLOCALE) && \
|
||||||
|
+ defined(HAVE_USELOCALE)
|
||||||
|
#define USE_XLOCALE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -731,7 +728,7 @@ gdouble
|
||||||
|
g_ascii_strtod (const gchar *nptr,
|
||||||
|
gchar **endptr)
|
||||||
|
{
|
||||||
|
-#ifdef USE_XLOCALE
|
||||||
|
+#if defined(USE_XLOCALE) && defined(HAVE_STRTOD_L)
|
||||||
|
|
||||||
|
g_return_val_if_fail (nptr != NULL, 0);
|
||||||
|
|
||||||
|
@@ -1044,7 +1041,7 @@ g_ascii_formatd (gchar *buffer,
|
||||||
|
#define TOUPPER(c) (ISLOWER (c) ? (c) - 'a' + 'A' : (c))
|
||||||
|
#define TOLOWER(c) (ISUPPER (c) ? (c) - 'A' + 'a' : (c))
|
||||||
|
|
||||||
|
-#ifndef USE_XLOCALE
|
||||||
|
+#if !defined(USE_XLOCALE) || !defined(HAVE_STRTOULL_L) || !defined(HAVE_STRTOLL_L)
|
||||||
|
|
||||||
|
static guint64
|
||||||
|
g_parse_long_long (const gchar *nptr,
|
||||||
|
@@ -1169,7 +1166,7 @@ g_parse_long_long (const gchar *nptr,
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
-#endif /* !USE_XLOCALE */
|
||||||
|
+#endif /* !defined(USE_XLOCALE) || !defined(HAVE_STRTOULL_L) || !defined(HAVE_STRTOLL_L) */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* g_ascii_strtoull:
|
||||||
|
@@ -1210,7 +1207,7 @@ g_ascii_strtoull (const gchar *nptr,
|
||||||
|
gchar **endptr,
|
||||||
|
guint base)
|
||||||
|
{
|
||||||
|
-#ifdef USE_XLOCALE
|
||||||
|
+#if defined(USE_XLOCALE) && defined(HAVE_STRTOULL_L)
|
||||||
|
return strtoull_l (nptr, endptr, base, get_C_locale ());
|
||||||
|
#else
|
||||||
|
gboolean negative;
|
||||||
|
@@ -1257,7 +1254,7 @@ g_ascii_strtoll (const gchar *nptr,
|
||||||
|
gchar **endptr,
|
||||||
|
guint base)
|
||||||
|
{
|
||||||
|
-#ifdef USE_XLOCALE
|
||||||
|
+#if defined(USE_XLOCALE) && defined(HAVE_STRTOLL_L)
|
||||||
|
return strtoll_l (nptr, endptr, base, get_C_locale ());
|
||||||
|
#else
|
||||||
|
gboolean negative;
|
||||||
|
--
|
||||||
|
2.34.1
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# Template file for 'glib'
|
# Template file for 'glib'
|
||||||
pkgname=glib
|
pkgname=glib
|
||||||
version=2.70.0
|
version=2.70.0
|
||||||
revision=2
|
revision=3
|
||||||
build_style=meson
|
build_style=meson
|
||||||
# static version is necessary for qemu-user-static;
|
# static version is necessary for qemu-user-static;
|
||||||
# also disable LTO, otherwise there are multiple failures when linking qemu
|
# also disable LTO, otherwise there are multiple failures when linking qemu
|
||||||
|
|
Loading…
Reference in New Issue