* libio/libio.h (_IO_FILE): Revert type of _chain to _IO_FILE*.

* libio/libioP.h (_IO_ITER): Revert to type _IO_FILE*. 
(FILEBUF_LITERAL): Add cast for CHAIN init. 
* libio/genops.c (_IO_un_link, _IO_link_in, _IO_iter_begin): Add casts. 
(_IO_flush_all, _IO_flush_all_linebuffered, _IO_unbuffer_write): 
Revert type of `fp' to _IO_FILE*. 
(_IO_iter_file): Remove cast. 
(_IO_iter_next): Elide intermediate member reference.
	* libio/libio.h (_IO_FILE): Revert type of _chain to _IO_FILE*.
	* libio/libioP.h (_IO_ITER): Revert to type _IO_FILE*.
	(FILEBUF_LITERAL): Add cast for CHAIN init.
	* libio/genops.c (_IO_un_link, _IO_link_in, _IO_iter_begin): Add casts.
	(_IO_flush_all, _IO_flush_all_linebuffered, _IO_unbuffer_write):
	Revert type of `fp' to _IO_FILE*.
	(_IO_iter_file): Remove cast.
	(_IO_iter_next): Elide intermediate member reference.
This commit is contained in:
Greg McGary 2000-07-04 00:49:25 +00:00
parent a88b96f496
commit 73c115ed0b
4 changed files with 42 additions and 32 deletions

View File

@ -5,6 +5,15 @@
2000-07-03 Greg McGary <greg@mcgary.org> 2000-07-03 Greg McGary <greg@mcgary.org>
* libio/libio.h (_IO_FILE): Revert type of _chain to _IO_FILE*.
* libio/libioP.h (_IO_ITER): Revert to type _IO_FILE*.
(FILEBUF_LITERAL): Add cast for CHAIN init.
* libio/genops.c (_IO_un_link, _IO_link_in, _IO_iter_begin): Add casts.
(_IO_flush_all, _IO_flush_all_linebuffered, _IO_unbuffer_write):
Revert type of `fp' to _IO_FILE*.
(_IO_iter_file): Remove cast.
(_IO_iter_next): Elide intermediate member reference.
* sysdeps/powerpc/strchr.S: Check bounds. * sysdeps/powerpc/strchr.S: Check bounds.
Wrap extern symbols in BP_SYM (). Wrap extern symbols in BP_SYM ().

View File

@ -45,11 +45,11 @@ _IO_un_link (fp)
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
_IO_lock_lock (list_all_lock); _IO_lock_lock (list_all_lock);
#endif #endif
for (f = &_IO_list_all; *f != NULL; f = &(*f)->file._chain) for (f = &_IO_list_all; *f; f = (struct _IO_FILE_plus **) &(*f)->file._chain)
{ {
if (*f == fp) if (*f == fp)
{ {
*f = fp->file._chain; *f = (struct _IO_FILE_plus *) fp->file._chain;
break; break;
} }
} }
@ -70,7 +70,7 @@ _IO_link_in (fp)
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
_IO_lock_lock (list_all_lock); _IO_lock_lock (list_all_lock);
#endif #endif
fp->file._chain = _IO_list_all; fp->file._chain = (_IO_FILE *) _IO_list_all;
_IO_list_all = fp; _IO_list_all = fp;
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
_IO_lock_unlock (list_all_lock); _IO_lock_unlock (list_all_lock);
@ -746,13 +746,13 @@ int
_IO_flush_all () _IO_flush_all ()
{ {
int result = 0; int result = 0;
struct _IO_FILE_plus *fp; struct _IO_FILE *fp;
for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain) for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
if (((fp->file._mode < 0 && fp->file._IO_write_ptr > fp->file._IO_write_base) if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
|| (fp->file._vtable_offset == 0 || (fp->_vtable_offset == 0
&& fp->file._mode > 0 && (fp->file._wide_data->_IO_write_ptr && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
> fp->file._wide_data->_IO_write_base))) > fp->_wide_data->_IO_write_base)))
&& _IO_OVERFLOW (&fp->file, EOF) == EOF) && _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF; result = EOF;
return result; return result;
} }
@ -760,10 +760,10 @@ _IO_flush_all ()
void void
_IO_flush_all_linebuffered () _IO_flush_all_linebuffered ()
{ {
struct _IO_FILE_plus *fp; struct _IO_FILE *fp;
for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain) for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
if ((fp->file._flags & _IO_NO_WRITES) == 0 && fp->file._flags & _IO_LINE_BUF) if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
_IO_OVERFLOW (&fp->file, EOF); _IO_OVERFLOW (fp, EOF);
} }
static void _IO_unbuffer_write __P ((void)); static void _IO_unbuffer_write __P ((void));
@ -771,12 +771,12 @@ static void _IO_unbuffer_write __P ((void));
static void static void
_IO_unbuffer_write () _IO_unbuffer_write ()
{ {
struct _IO_FILE_plus *fp; struct _IO_FILE *fp;
for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain) for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
if (! (fp->file._flags & _IO_UNBUFFERED) if (! (fp->_flags & _IO_UNBUFFERED)
&& (! (fp->file._flags & _IO_NO_WRITES) && (! (fp->_flags & _IO_NO_WRITES)
|| (fp->file._flags & _IO_IS_APPENDING))) || (fp->_flags & _IO_IS_APPENDING)))
_IO_SETBUF (&fp->file, NULL, 0); _IO_SETBUF (fp, NULL, 0);
} }
int int
@ -1038,7 +1038,7 @@ _IO_default_imbue (fp, locale)
_IO_ITER _IO_ITER
_IO_iter_begin() _IO_iter_begin()
{ {
return _IO_list_all; return (_IO_ITER) _IO_list_all;
} }
_IO_ITER _IO_ITER
@ -1051,14 +1051,14 @@ _IO_ITER
_IO_iter_next(iter) _IO_iter_next(iter)
_IO_ITER iter; _IO_ITER iter;
{ {
return iter->file._chain; return iter->_chain;
} }
_IO_FILE * _IO_FILE *
_IO_iter_file(iter) _IO_iter_file(iter)
_IO_ITER iter; _IO_ITER iter;
{ {
return (_IO_FILE *) iter; return iter;
} }
void void

View File

@ -252,8 +252,6 @@ struct _IO_wide_data
struct _IO_jump_t *_wide_vtable; struct _IO_jump_t *_wide_vtable;
}; };
struct _IO_FILE_plus;
struct _IO_FILE { struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags #define _IO_file_flags _flags
@ -275,7 +273,7 @@ struct _IO_FILE {
struct _IO_marker *_markers; struct _IO_marker *_markers;
struct _IO_FILE_plus *_chain; struct _IO_FILE *_chain;
int _fileno; int _fileno;
int _blksize; int _blksize;
@ -312,6 +310,8 @@ struct _IO_FILE_complete
typedef struct _IO_FILE _IO_FILE; typedef struct _IO_FILE _IO_FILE;
#endif #endif
struct _IO_FILE_plus;
extern struct _IO_FILE_plus _IO_2_1_stdin_; extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_; extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_; extern struct _IO_FILE_plus _IO_2_1_stderr_;

View File

@ -323,7 +323,7 @@ struct _IO_cookie_file
/* Iterator type for walking global linked list of _IO_FILE objects. */ /* Iterator type for walking global linked list of _IO_FILE objects. */
typedef struct _IO_FILE_plus *_IO_ITER; typedef struct _IO_FILE *_IO_ITER;
/* Generic functions */ /* Generic functions */
@ -708,12 +708,12 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# ifdef _IO_USE_OLD_IO_FILE # ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \ # define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock } 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock }
# else # else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \ # define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\ 0, _IO_pos_BAD, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock, _IO_pos_BAD,\
NULL, WDP, 0 } NULL, WDP, 0 }
# endif # endif
@ -721,11 +721,12 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# ifdef _IO_USE_OLD_IO_FILE # ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \ # define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, 0, _IO_pos_BAD } 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD }
# else # else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \ # define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \ { _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+FLAGS, \
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (_IO_FILE *) CHAIN, FD, \
0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \ 0, _IO_pos_BAD, 0, 0, { 0 }, 0, _IO_pos_BAD, \
NULL, WDP, 0 } NULL, WDP, 0 }
# endif # endif