From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/10433 Path: news.gmane.org!.POSTED!not-for-mail From: Daniel Sabogal Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] add missing *_unlocked and wcsftime_l prototypes to wchar.h Date: Fri, 9 Sep 2016 20:42:45 -0400 Message-ID: References: <20160906210939.32637-1-dsabogalcc@gmail.com> <20160906210939.32637-2-dsabogalcc@gmail.com> <20160909230241.GT15995@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1473468185 18620 195.159.176.226 (10 Sep 2016 00:43:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 10 Sep 2016 00:43:05 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-10446-gllmg-musl=m.gmane.org@lists.openwall.com Sat Sep 10 02:43:00 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1biWNm-00048B-CP for gllmg-musl@m.gmane.org; Sat, 10 Sep 2016 02:42:58 +0200 Original-Received: (qmail 15473 invoked by uid 550); 10 Sep 2016 00:42:58 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 15455 invoked from network); 10 Sep 2016 00:42:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=nwIRQzkgYKtvYx3KO85cU+fizWpOpytUqR3KcK2UE4w=; b=SuqDOvuDEKXPrJFKQJfVoi2IUwltiqPRAjGZP497Y0JUTFvSXPJ9rYUyY4j4Gnj5c+ nrOdy96V0ckZjtwPKvFxDTeIBGpPntdcEcRXUwl+pDFY3TILkD0QSSCVyboNgJ0oLlFZ yPqPBUwlUkJ9JEpwElUpabGTVzqU/qMfenDLP4Np47+uIVPb4UBJgbBGsiwc9iEnVCBg iPCfrDe946ssR9tBkaB/8rxZpCJiT0sRO3+I9IYJQOA27iO81iuE0plzM3nM+Ijah3YV GxTDBwAI2FBfbrgpCtslHtfxcvIoHpSJY4SiMxuqgVrqbTK2AkUeZdsiE16kAp/WN/Rc /AbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=nwIRQzkgYKtvYx3KO85cU+fizWpOpytUqR3KcK2UE4w=; b=EdfTMkG+NT1qVYVzXCsTiq/IyXJrmH38hzCcSUWKsPqujbOmp31faq/+UAixih8GK1 +NHgi0+67ZuWrjYiINHnSKUUSd08OoZswMlJMC6sW+0YxO/bVuab0hiSncxH7UUmnv+B 8YQwlHz5Z/eGmjyCcPZ3C/wTn9aahhZVOfNoxdCaDMUCylhQus0WVEZvVcHOj23o/Wbb ypi+eSymkdgL+j3JDOZMVuF8dWjsZ59tY3D5MtOdJOyDmA+TlRrS6w5haR+PLj485gLD V35maECVmxX7JO7v7Nq1aAGiUKo9tCkf9Feuf3WNwCvoHi9zyMnF3WeYQEHOAPNZUZpm MDyQ== X-Gm-Message-State: AE9vXwMwACvHvorJd2j5FhEi73ins/yC4103Yl2T58cBvxCLB5I+KtZVD7wSC18HLfh0Zcx6KO2QcB5xC5ohpg== X-Received: by 10.157.27.68 with SMTP id l62mr8120357otl.119.1473468166201; Fri, 09 Sep 2016 17:42:46 -0700 (PDT) In-Reply-To: <20160909230241.GT15995@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:10433 Archived-At: On Fri, Sep 9, 2016 at 7:02 PM, Rich Felker wrote: > On Tue, Sep 06, 2016 at 05:09:39PM -0400, Daniel Sabogal wrote: >> these functions had been implemented, but prototypes were not made available >> --- >> include/wchar.h | 12 ++++++++++++ >> src/stdio/getwchar.c | 2 -- >> src/stdio/getwchar_unlocked.c | 8 ++++++++ >> src/stdio/putwchar.c | 2 -- >> src/stdio/putwchar_unlocked.c | 8 ++++++++ >> 5 files changed, 28 insertions(+), 4 deletions(-) >> create mode 100644 src/stdio/getwchar_unlocked.c >> create mode 100644 src/stdio/putwchar_unlocked.c >> >> diff --git a/include/wchar.h b/include/wchar.h >> index 0167dce..58818f6 100644 >> --- a/include/wchar.h >> +++ b/include/wchar.h >> @@ -136,6 +136,18 @@ size_t wcsftime (wchar_t *__restrict, size_t, const wchar_t *__restrict, const s >> >> #undef iswdigit >> >> +#if defined(_GNU_SOURCE) >> +wint_t fgetwc_unlocked (FILE *); >> +wint_t getwc_unlocked (FILE *); >> +wint_t getwchar_unlocked (void); >> +wint_t fputwc_unlocked (wchar_t, FILE *); >> +wint_t putwc_unlocked (wchar_t, FILE *); >> +wint_t putwchar_unlocked (wchar_t); >> +wchar_t *fgetws_unlocked (wchar_t *__restrict, int, FILE *__restrict); >> +int fputws_unlocked (const wchar_t *__restrict, FILE *__restrict); >> +size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); >> +#endif > > I suspect BSDs also had these so they should possibly be exposed under > _GNU_SOURCE || _BSD_SOURCE. Thoughts? Glibc doesn't provide any of these with _BSD_SOURCE. FreeBSD and NetBSD provide wcsftime_l, but doesn't seem to have the *_unlocked variants. OpenBSD doesn't seem to provide either. Perhaps wcsftime_l should be moved under _GNU_SOURCE || _BSD_SOURCE. >> diff --git a/src/stdio/getwchar.c b/src/stdio/getwchar.c >> index bd89e0e..77a9dc1 100644 >> --- a/src/stdio/getwchar.c >> +++ b/src/stdio/getwchar.c >> @@ -5,5 +5,3 @@ wint_t getwchar(void) >> { >> return fgetwc(stdin); >> } >> - >> -weak_alias(getwchar, getwchar_unlocked); >> diff --git a/src/stdio/getwchar_unlocked.c b/src/stdio/getwchar_unlocked.c >> new file mode 100644 >> index 0000000..1d00567 >> --- /dev/null >> +++ b/src/stdio/getwchar_unlocked.c >> @@ -0,0 +1,8 @@ >> +#define _GNU_SOURCE >> +#include "stdio_impl.h" >> +#include >> + >> +wint_t getwchar_unlocked(void) >> +{ >> + return fgetwc_unlocked(stdin); >> +} > > What is the motivation for replacing the aliases with wrappers? This > does not seem like an improvement. > > Rich Correct me if I'm wrong, but by using weak_alias(getwchar, getwchar_unlocked) instead of the wrapper, wouldn't calls to getwchar_unlocked() really just invoke getwchar() or fgetwc(stdin) instead of the intended fgetwc_unlocked(stdin)?