1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- The fputc() and __putc() macros were not entirely free of side-effects. Ouch.

git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15210 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2010-10-19 09:35:16 +00:00
parent 6bc8108a39
commit 81e66075e2
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio.h,v 1.22 2006-03-06 08:43:48 obarthel Exp $
* $Id: stdio.h,v 1.23 2010-10-19 09:35:16 obarthel Exp $
*
* :ts=4
*
@ -287,9 +287,9 @@ extern char *tmpnam(char *buf);
(((FILE *)(f))->num_write_bytes < ((FILE *)(f))->size)) ? \
(((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes++] = (c), \
(((((FILE *)(f))->flags & __FILE_BUFFER_MASK) == _IOLBF && \
((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes-1] == '\n') ? \
(c) == '\n') ? \
__flush(f) : \
(((FILE *)(f))->buffer[((FILE *)(f))->num_write_bytes-1]))) : \
(c))) : \
fputc((c),(f)))
/****************************************************************************/

View File

@ -1,5 +1,5 @@
/*
* $Id: stdio_headers.h,v 1.31 2008-09-04 12:07:58 obarthel Exp $
* $Id: stdio_headers.h,v 1.32 2010-10-19 09:35:16 obarthel Exp $
*
* :ts=4
*
@ -279,10 +279,9 @@ struct iob
#define __putc(c,f,m) \
(((((struct iob *)(f))->iob_BufferWriteBytes < ((struct iob *)(f))->iob_BufferSize)) ? \
(((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes++] = (c), \
(((m) == IOBF_BUFFER_MODE_LINE && \
((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes-1] == '\n') ? \
(((m) == IOBF_BUFFER_MODE_LINE && (c) == '\n') ? \
__flush(f) : \
(((struct iob *)(f))->iob_Buffer[((struct iob *)(f))->iob_BufferWriteBytes-1]))) : \
(c))) : \
__fputc((c),(f),(m)))
#define __putc_fully_buffered(c,f) \