Mail Archives: djgpp-workers/1999/06/13/04:15:10
On Thu, 10 Jun 1999, Alain Magloire wrote:
> Ok, I don't know if this is the right approach, I simply redefine
> the PUTC(ch) macro in doprnt.c :
I'd prefer to change __putc (on <libc/file.h>) so that it simply
returns without doing anything when fp->_cnt is non-positive. After
all, __putc has no business calling _flsbuf for fake streams with
_IOSTRG flag set, so we might as well say it explicitly, instead of
relying on INT_MAX to never be exhausted, which just might become
untrue one day.
DJ, do you have preferences as to where to make this change?
> #define PUTC(ch) \
> do { \
> if (fp->_flags & _IOSTRG && fp->_flags & _IOWRT && !fp->_cnt) \
> return counter; \
This seems to be inconsistent with the function definition: the
counter needs to be bumped up even if the string buffer is already
exhausted. Otherwise, we won't be able to return the space that
should have been allocated in order to produce the complete output.
- Raw text -