[PATCH 04/20] unlocked stdio extensions

Corinna Vinschen vinschen@redhat.com
Wed Dec 17 20:10:00 GMT 2014


On Dec 17 12:33, Yaakov Selkowitz wrote:
> Index: libc/stdio/fflush_u.c
> ===================================================================
> [...]
> +_DEFUN(_fflush_unlocked_r, (ptr, fp),
> +       struct _reent *ptr _AND
> +       register FILE * fp)
> +{
> +  int ret;
> +
> +#ifdef _REENT_SMALL
> +  /* For REENT_SMALL platforms, it is possible we are being
> +     called for the first time on a std stream.  This std
> +     stream can belong to a reentrant struct that is not
> +     _REENT.  If CHECK_INIT gets called below based on _REENT,
> +     we will end up changing said file pointers to the equivalent
> +     std stream off of _REENT.  This causes unexpected behavior if
> +     there is any data to flush on the _REENT std stream.  There
> +     are two alternatives to fix this:  1) make a reentrant fflush
> +     or 2) simply recognize that this file has nothing to flush
> +     and return immediately before performing a CHECK_INIT.  Choice
> +     2 is implemented here due to its simplicity.  */
> +  if (fp->_bf._base == NULL)
> +    return 0;
> +#endif /* _REENT_SMALL  */

Patch 01-03 are ok.  For this code here we should have a comment describing
what we do in _fflush_r only.  The comment here in _fflush_unlocked_r
should point to the comment in fflush_r instead.   Both comments should
clearly point out that a change requires to change both files.

Except for this comment issue, patch 04 is ok.


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20141217/37c89ddd/attachment.sig>


More information about the Newlib mailing list