bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: Re: CVS commit: pkgsrc/devel/m4]


From: Eric Blake
Subject: Re: address@hidden: Re: CVS commit: pkgsrc/devel/m4]
Date: Tue, 31 Jul 2007 06:23:13 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.5) Gecko/20070716 Thunderbird/2.0.0.5 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Bruno Haible on 7/27/2007 4:11 PM:
> Thanks for this idea. Eric, here is a proposed patch for gnulib, that
> additionally:
> 
>   - uses the #ifdef for BSD systems,
> 
>   - not only sets __SNPT but also resets __SOPT. __SOPT tells fseek that
>     it can use block-alignment as for regular files, __SNPT tells fseek
>     that it must not do so. Since it is undocumented which of the two
>     flags is tested first by fseek(), it is safer to reset __SOPT.
> 
>   - restores the previous flags after calling fseeko. Setting __SNPT
>     means to disable block-aligned reading for *all* future fseek calls,
>     but we need it only for the next one.

I've finally had time to look at this.  Your patch is on par with what was
done in the newlib library last year (the newlib library currently does
not require the fflush/fseek replacement), so I think it is worth
applying, after addressing any nits.  It would be nice if NetBSD could
fold these sorts of patches in upstream (ie. make fflush work on input
streams, and make fflush and fseek cooperate so that fseek can continue to
optimize in all cases except where an fflush has just happened), but until
then, the ./configure script will still pick up that gnulib's rpl_fflush
still requires the use of rpl_fseeko for correct semantics.

> 2007-07-27  Bruno Haible  <address@hidden>
> 
>       * lib/fflush.c (rpl_fflush): On BSD systems, use the __SNPT flag.
>       Suggested by Joerg Sonnenberger <address@hidden>.
...
> 
> +     int saved_flags = stream->_flags & (__SOPT | __SNPT);
> +     stream->_flags &= ~__SOPT;
> +     stream->_flags |= __SNPT;

Is it more efficient to write it like this?
stream->_flags = (stream->_flags & ~__SOPT) | __SNPT;

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGrymi84KuGfSFAYARAvqtAJ9iQV8x+hqjxH9U0I5fgtgP3JS2+gCfToqD
uyCy4vW0WQurv4gBswA1a88=
=8Xjk
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]