This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 04/20] unlocked stdio extensions

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.


Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgplLJVleSDWw.pgp
Description: PGP signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]