mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-05-05 12:26:52 +02:00
main/musl: backport patch for _NL_LOCALE_NAME
needed by libidn testsuite https://github.com/alpinelinux/aports/pull/2320#issuecomment-330380719
This commit is contained in:
parent
c414927dc3
commit
752eb06ec4
@ -0,0 +1,59 @@
|
||||
From 947d330f68c49680dcc54439f56da2a297228962 Mon Sep 17 00:00:00 2001
|
||||
From: Rich Felker <dalias@aerifal.cx>
|
||||
Date: Mon, 31 Jul 2017 23:08:27 -0400
|
||||
Subject: [PATCH] add _NL_LOCALE_NAME extension to nl_langinfo
|
||||
|
||||
since setlocale(cat, NULL) is required to return the setting for the
|
||||
global locale, there is no standard mechanism to obtain the name of
|
||||
the currently active thread-local locale set by uselocale. this makes
|
||||
it impossible for application/library software to load appropriate
|
||||
translations, etc. unless using the gettext implementation provided by
|
||||
libc, which has privileged access to libc internals.
|
||||
|
||||
to fill this gap, glibc introduced the _NL_LOCALE_NAME macro which can
|
||||
be used with nl_langinfo to obtain the name. GNU gettext/gnulib code
|
||||
already use this functionality on glibc, and can easily be adapted to
|
||||
make use of it on non-glibc systems if it's available; for other
|
||||
systems they poke at locale implementation internals, which we want to
|
||||
avoid. this patch provides a compatible interface to the one glibc
|
||||
introduced.
|
||||
---
|
||||
include/langinfo.h | 6 ++++++
|
||||
src/locale/langinfo.c | 4 ++++
|
||||
2 files changed, 10 insertions(+)
|
||||
|
||||
diff --git a/include/langinfo.h b/include/langinfo.h
|
||||
index 2153c42e..519c0612 100644
|
||||
--- a/include/langinfo.h
|
||||
+++ b/include/langinfo.h
|
||||
@@ -77,6 +77,12 @@ extern "C" {
|
||||
#define YESEXPR 0x50000
|
||||
#define NOEXPR 0x50001
|
||||
|
||||
+#define _NL_LOCALE_NAME(cat) (((cat)<<16) | 0xffff)
|
||||
+
|
||||
+#if defined(_GNU_SOURCE)
|
||||
+#define NL_LOCALE_NAME(cat) _NL_LOCALE_NAME(cat)
|
||||
+#endif
|
||||
+
|
||||
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
||||
#define YESSTR 0x50002
|
||||
#define NOSTR 0x50003
|
||||
diff --git a/src/locale/langinfo.c b/src/locale/langinfo.c
|
||||
index b2c8569e..b16caf44 100644
|
||||
--- a/src/locale/langinfo.c
|
||||
+++ b/src/locale/langinfo.c
|
||||
@@ -34,6 +34,10 @@ char *__nl_langinfo_l(nl_item item, locale_t loc)
|
||||
const char *str;
|
||||
|
||||
if (item == CODESET) return MB_CUR_MAX==1 ? "ASCII" : "UTF-8";
|
||||
+
|
||||
+ /* _NL_LOCALE_NAME extension */
|
||||
+ if (idx == 65535 && cat < LC_ALL)
|
||||
+ return loc->cat[cat] ? (char *)loc->cat[cat]->name : "C";
|
||||
|
||||
switch (cat) {
|
||||
case LC_NUMERIC:
|
||||
--
|
||||
2.14.1
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
# Maintainer: Timo Teräs <timo.teras@iki.fi>
|
||||
pkgname=musl
|
||||
pkgver=1.1.16
|
||||
pkgrel=19
|
||||
pkgrel=20
|
||||
pkgdesc="the musl c library (libc) implementation"
|
||||
url="http://www.musl-libc.org/"
|
||||
arch="all"
|
||||
@ -79,6 +79,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
|
||||
2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
|
||||
2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch
|
||||
3001-s390x-add-bits-hwcap.h.patch
|
||||
0001-add-_NL_LOCALE_NAME-extension-to-nl_langinfo.patch
|
||||
|
||||
ldconfig
|
||||
__stack_chk_fail_local.c
|
||||
@ -264,6 +265,7 @@ dde4bb6c877d4fdf976e3ffea5d0a4a48f365708c488ceeaa4dcc29296820517aebbfa3b0527d74d
|
||||
2c8e1dde1834238097b2ee8a7bfb53471a0d9cff4a5e38b55f048b567deff1cdd47c170d0578a67b1a039f95a6c5fbb8cff369c75b6a3e4d7ed171e8e86ebb8c 2000-pthread-internals-increase-DEFAULT_GUARD_SIZE-to-2-p.patch
|
||||
76330dfff60b2a8703ddc38f378995334ab0fa56e31e499937a4b4dfd8ff4a0bf1f8108174e8f863810de5cc28ff4c50656b886ee468605072bc55310a077624 2001-thread-do-not-attempt-to-join-detached-threads-in-pt.patch
|
||||
9c87849e6a58f393aaf4fa7dca31a010a369d41b2f24cdde6af0303df0436e2ef2ca5b767b5584b93f5c9c98e200ac2a972688b8ce2838a5ff9b746982085bcb 3001-s390x-add-bits-hwcap.h.patch
|
||||
d725bb4990c5b2cdb88f6ecbe1f63895b29717c0ae3af60181588dd41cb10cd201f2faaade26f1abd31b568964a327131dad6f928717d953f44d7ef625ea8955 0001-add-_NL_LOCALE_NAME-extension-to-nl_langinfo.patch
|
||||
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
|
||||
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
|
||||
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user