Message ID | 1451679626-28351-1-git-send-email-raj.khem@gmail.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 124900 invoked by alias); 1 Jan 2016 20:20:36 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 124889 invoked by uid 89); 1 Jan 2016 20:20:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:1061, ldv@altlinux.org, D*altlinux.org, sk:ldvalt X-HELO: mail-qk0-f172.google.com X-Received: by 10.55.41.138 with SMTP id p10mr99135322qkp.18.1451679631950; Fri, 01 Jan 2016 12:20:31 -0800 (PST) From: Khem Raj <raj.khem@gmail.com> To: libc-alpha@sourceware.org Cc: Khem Raj <raj.khem@gmail.com> Subject: [PATCH] argp: Use fwrite_unlocked instead of __fxprintf when !_LIBC Date: Fri, 1 Jan 2016 20:20:26 +0000 Message-Id: <1451679626-28351-1-git-send-email-raj.khem@gmail.com> |
Commit Message
Khem Raj
Jan. 1, 2016, 8:20 p.m. UTC
__fxprintf is not available when argp is built outside libc
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
ChangeLog | 5 +++++
argp/argp-fmtstream.c | 4 ++++
2 files changed, 9 insertions(+)
Comments
On 01 Jan 2016 20:20, Khem Raj wrote: > __fxprintf is not available when argp is built outside libc > > Signed-off-by: Khem Raj <raj.khem@gmail.com> > --- > ChangeLog | 5 +++++ > argp/argp-fmtstream.c | 4 ++++ i forget where we document these things, but usually modules that utilize _LIBC are kept in sync with other projects, and we often like to see such changes sent/merged simultaneously with them. this one looks like gnulib. -mike
On 01/01/2016 09:20 PM, Khem Raj wrote: > +#ifdef _LIBC > __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); > +#else > + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); > +#endif Why not use fwrite_unlocked unconditionally? Thanks, Florian
On Mon, 4 Jan 2016, Florian Weimer wrote: > On 01/01/2016 09:20 PM, Khem Raj wrote: > > > +#ifdef _LIBC > > __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); > > +#else > > + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); > > +#endif > > Why not use fwrite_unlocked unconditionally? Does fwrite_unlocked work on wide-oriented streams in glibc (the point of __fxprintf as I understand it being to work whatever the orientation of the stream)?
On Fri, Jan 1, 2016 at 7:21 PM, Mike Frysinger <vapier@gentoo.org> wrote: > On 01 Jan 2016 20:20, Khem Raj wrote: >> __fxprintf is not available when argp is built outside libc >> >> Signed-off-by: Khem Raj <raj.khem@gmail.com> >> --- >> ChangeLog | 5 +++++ >> argp/argp-fmtstream.c | 4 ++++ > > i forget where we document these things, but usually modules that utilize > _LIBC are kept in sync with other projects, and we often like to see such > changes sent/merged simultaneously with them. this one looks like gnulib. gnulib already have a check for it introduced via this commit http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c72047a1ed44c8c9509f1593d726ccd63ceb965c it checks for USE_IN_LIBIO > -mike
On 04 Jan 2016 11:08, Khem Raj wrote: > On Fri, Jan 1, 2016 at 7:21 PM, Mike Frysinger wrote: > > On 01 Jan 2016 20:20, Khem Raj wrote: > >> __fxprintf is not available when argp is built outside libc > >> > >> Signed-off-by: Khem Raj <raj.khem@gmail.com> > >> --- > >> ChangeLog | 5 +++++ > >> argp/argp-fmtstream.c | 4 ++++ > > > > i forget where we document these things, but usually modules that utilize > > _LIBC are kept in sync with other projects, and we often like to see such > > changes sent/merged simultaneously with them. this one looks like gnulib. > > gnulib already have a check for it introduced via this commit > > http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c72047a1ed44c8c9509f1593d726ccd63ceb965c that's stronger justification imo for merging > it checks for USE_IN_LIBIO it would be nice if we could fully sync these two files so they're in agreement again, but i won't force that on you :). -mike
On 01/04/2016 04:36 PM, Joseph Myers wrote: > On Mon, 4 Jan 2016, Florian Weimer wrote: > >> On 01/01/2016 09:20 PM, Khem Raj wrote: >> >>> +#ifdef _LIBC >>> __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); >>> +#else >>> + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); >>> +#endif >> >> Why not use fwrite_unlocked unconditionally? > > Does fwrite_unlocked work on wide-oriented streams in glibc (the point of > __fxprintf as I understand it being to work whatever the orientation of > the stream)? Oh, I didn't know this was the point of fxprintf. No, in this case, using fwrite_unlocked would not work (in fact, it would be undefined). Florian
> On Jan 4, 2016, at 11:31 AM, Mike Frysinger <vapier@gentoo.org> wrote: > > On 04 Jan 2016 11:08, Khem Raj wrote: >> On Fri, Jan 1, 2016 at 7:21 PM, Mike Frysinger wrote: >>> On 01 Jan 2016 20:20, Khem Raj wrote: >>>> __fxprintf is not available when argp is built outside libc >>>> >>>> Signed-off-by: Khem Raj <raj.khem@gmail.com> >>>> --- >>>> ChangeLog | 5 +++++ >>>> argp/argp-fmtstream.c | 4 ++++ >>> >>> i forget where we document these things, but usually modules that utilize >>> _LIBC are kept in sync with other projects, and we often like to see such >>> changes sent/merged simultaneously with them. this one looks like gnulib. >> >> gnulib already have a check for it introduced via this commit >> >> http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c72047a1ed44c8c9509f1593d726ccd63ceb965c > > that's stronger justification imo for merging Can you help with merging it > >> it checks for USE_IN_LIBIO > > it would be nice if we could fully sync these two files so they're > in agreement again, but i won't force that on you :). USE_IN_LIBIO is no longer used in glibc. > -mike
On 05 Jan 2016 13:13, Khem Raj wrote: > > On Jan 4, 2016, at 11:31 AM, Mike Frysinger wrote: > > On 04 Jan 2016 11:08, Khem Raj wrote: > >> On Fri, Jan 1, 2016 at 7:21 PM, Mike Frysinger wrote: > >>> On 01 Jan 2016 20:20, Khem Raj wrote: > >>>> __fxprintf is not available when argp is built outside libc > >>>> > >>>> Signed-off-by: Khem Raj <raj.khem@gmail.com> > >>>> --- > >>>> ChangeLog | 5 +++++ > >>>> argp/argp-fmtstream.c | 4 ++++ > >>> > >>> i forget where we document these things, but usually modules that utilize > >>> _LIBC are kept in sync with other projects, and we often like to see such > >>> changes sent/merged simultaneously with them. this one looks like gnulib. > >> > >> gnulib already have a check for it introduced via this commit > >> > >> http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=c72047a1ed44c8c9509f1593d726ccd63ceb965c > > > > that's stronger justification imo for merging > > Can you help with merging it pushed now > >> it checks for USE_IN_LIBIO > > > > it would be nice if we could fully sync these two files so they're > > in agreement again, but i won't force that on you :). > > USE_IN_LIBIO is no longer used in glibc. i don't mean the code needs to flow in one direction -mike
diff --git a/ChangeLog b/ChangeLog index 51a055c..0bfb1fd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2016-01-01 Khem Raj <raj.khem@gmail.com> + + * argp/argp-fmtstream.c (__argp_fmtstream_free): Use fwrite_unlocked + instead of __fxprintf when _LIBC is undefined. + 2015-12-30 Dmitry V. Levin <ldv@altlinux.org> [BZ #19408] diff --git a/argp/argp-fmtstream.c b/argp/argp-fmtstream.c index 2b845e0..f8de40e 100644 --- a/argp/argp-fmtstream.c +++ b/argp/argp-fmtstream.c @@ -100,7 +100,11 @@ __argp_fmtstream_free (argp_fmtstream_t fs) __argp_fmtstream_update (fs); if (fs->p > fs->buf) { +#ifdef _LIBC __fxprintf (fs->stream, "%.*s", (int) (fs->p - fs->buf), fs->buf); +#else + fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream); +#endif } free (fs->buf); free (fs);