From patchwork Mon Mar 20 20:35:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rafal Luzynski X-Patchwork-Id: 741161 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vn74v356vz9rvt for ; Tue, 21 Mar 2017 07:35:59 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="solFO/Tg"; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:reply-to:to:message-id:subject :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=JC7AtvaqWxoDEQXpNcn3fcaoRdOiGGaOr4xoTHOrR/LwEPiDopytw kl8qdqyjw24rxDpXTgsGfpH62HNDBE54wD85tBe1cx9z4l2Nf8Ez82zXq6yqk46y NW4hJCnwJTCDBsU3DQsncEGT/8gX3N4egr+mPhoMYXwi6Kez3yXTGk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:reply-to:to:message-id:subject :mime-version:content-type:content-transfer-encoding; s=default; bh=lESlNRpDKAMpXCdwi/OAFLmdHz8=; b=solFO/TgGUDH6inLdZdZu69yII9v LD335q62x113ewJYItxg6LGezZmyh3ug2ENw/7DGvdtIaPEReyELyab5WBiACfN2 y3vNAHZOfsN/nwpg90Z6+Fr0lZkZRepB1i23kKrzJbOLRvhojr1gfMfMVggHHnOL zgV0RduTSUhxBWQ= Received: (qmail 41812 invoked by alias); 20 Mar 2017 20:35:52 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 41795 invoked by uid 89); 20 Mar 2017 20:35:51 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-23.3 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=(unknown), 2113, month, family X-HELO: aev204.rev.netart.pl X-Spam-Score: 0 Date: Mon, 20 Mar 2017 21:35:48 +0100 (CET) From: Rafal Luzynski Reply-To: Rafal Luzynski To: libc-alpha@sourceware.org Message-ID: <102050482.88094.1490042148562@poczta.nazwa.pl> Subject: [RFC][PATCH v6 02/16] Provide backward compatibility for nl_langinfo family (bug 10871). MIME-Version: 1.0 X-Originating-Client: com.openexchange.ox.gui.dhtml As ALTMON_1 .. ALTMON_12 constants have been added to nl_langinfo* family of functions backward compatibility implementation must be provided for older binaries which assume that MON_1 .. MON_12 return month names in their nominative case. [BZ #10871] * include/langinfo.h: Declare __nl_langinfo_noaltmon_l. * locale/Versions (libc: GLIBC_2.26): New nl_langinfo* added. * locale/nl_langinfo.c: Provide backward compatible version. * locale/nl_langinfo_l.c: Likewise. --- include/langinfo.h | 2 ++ locale/Versions | 3 +++ locale/nl_langinfo.c | 17 +++++++++++++++-- locale/nl_langinfo_l.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 66 insertions(+), 5 deletions(-) diff --git a/include/langinfo.h b/include/langinfo.h index d60d7f6..60729e4 100644 --- a/include/langinfo.h +++ b/include/langinfo.h @@ -7,6 +7,8 @@ libc_hidden_proto (nl_langinfo) extern __typeof (nl_langinfo_l) __nl_langinfo_l; libc_hidden_proto (__nl_langinfo_l) +extern __typeof (nl_langinfo_l) __nl_langinfo_noaltmon_l; +libc_hidden_proto (__nl_langinfo_noaltmon_l) #endif #endif diff --git a/locale/Versions b/locale/Versions index 7211934..43ee687 100644 --- a/locale/Versions +++ b/locale/Versions @@ -66,6 +66,9 @@ libc { wcstoll_l; wcstoul_l; wcstoull_l; wcsxfrm_l; wctype_l; wctrans_l; nl_langinfo_l; } + GLIBC_2.26 { + nl_langinfo; nl_langinfo_l; __nl_langinfo_l; + } GLIBC_PRIVATE { # global variables __collate_element_hash; __collate_element_strings; diff --git a/locale/nl_langinfo.c b/locale/nl_langinfo.c index 3a21fba..82468db 100644 --- a/locale/nl_langinfo.c +++ b/locale/nl_langinfo.c @@ -21,13 +21,26 @@ #include #include #include "localeinfo.h" +#include /* Return a string with the data for locale-dependent parameter ITEM. */ char * -nl_langinfo (nl_item item) +__nl_langinfo (nl_item item) { return __nl_langinfo_l (item, _NL_CURRENT_LOCALE); } -libc_hidden_def (nl_langinfo) +versioned_symbol (libc, __nl_langinfo, nl_langinfo, GLIBC_2_26); +libc_hidden_ver (__nl_langinfo, nl_langinfo) + + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_26) +char * +attribute_compat_text_section +__nl_langinfo_noaltmon (nl_item item) +{ + return __nl_langinfo_noaltmon_l (item, _NL_CURRENT_LOCALE); +} +compat_symbol (libc, __nl_langinfo_noaltmon, nl_langinfo, GLIBC_2_0); +#endif diff --git a/locale/nl_langinfo_l.c b/locale/nl_langinfo_l.c index 89acdbd..467a341 100644 --- a/locale/nl_langinfo_l.c +++ b/locale/nl_langinfo_l.c @@ -22,12 +22,13 @@ #include #include #include "localeinfo.h" +#include /* Return a string with the data for locale-dependent parameter ITEM. */ char * -__nl_langinfo_l (nl_item item, __locale_t l) +__nl_langinfo_l_internal (nl_item item, __locale_t l) { int category = _NL_ITEM_CATEGORY (item); unsigned int index = _NL_ITEM_INDEX (item); @@ -65,5 +66,47 @@ __nl_langinfo_l (nl_item item, __locale_t l) /* Return the string for the specified item. */ return (char *) data->values[index].string; } -libc_hidden_def (__nl_langinfo_l) -weak_alias (__nl_langinfo_l, nl_langinfo_l) +strong_alias (__nl_langinfo_l_internal, __nl_langinfo_l_internal_alias) +versioned_symbol (libc, __nl_langinfo_l_internal, + __nl_langinfo_l, GLIBC_2_26); +libc_hidden_ver (__nl_langinfo_l_internal, __nl_langinfo_l) +versioned_symbol (libc, __nl_langinfo_l_internal_alias, + nl_langinfo_l, GLIBC_2_26); +libc_hidden_ver (__nl_langinfo_l_internal_alias, nl_langinfo_l) + + +#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_26) +char * +attribute_compat_text_section +__nl_langinfo_noaltmon_l (nl_item item, __locale_t l) +{ + if ((item >= ALTMON_1 && item <= ALTMON_12) + || (item >= _NL_WALTMON_1 && item <= _NL_WALTMON_12)) + /* Pretend it's a bogus index for this category: bogus item. */ + return (char *) ""; + else if (item >= MON_1 && item <= MON_12) + { + /* ALTMON_... item contains what MON_... item contained before. */ + return __nl_langinfo_l (item + ALTMON_1 - MON_1, l); + } + else if (item >= _NL_WMON_1 && item <= _NL_WMON_12) + { + /* The same for _NL_WALTMON_... and _NL_WMON_... */ + return __nl_langinfo_l (item + _NL_WALTMON_1 - _NL_WMON_1, l); + } + + /* Default result if it is not a month. */ + return __nl_langinfo_l (item, l); +} +libc_hidden_def (__nl_langinfo_noaltmon_l) +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_2, GLIBC_2_26) +strong_alias (__nl_langinfo_noaltmon_l, __nl_langinfo_noaltmon_l_alias) +compat_symbol (libc, __nl_langinfo_noaltmon_l_alias, + __nl_langinfo_l, GLIBC_2_2); +#endif + +#if SHLIB_COMPAT (libc, GLIBC_2_3, GLIBC_2_26) +compat_symbol (libc, __nl_langinfo_noaltmon_l, nl_langinfo_l, GLIBC_2_3); +#endif