aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--libio/genops.c46
-rw-r--r--libio/libio.h6
-rw-r--r--libio/libioP.h13
4 files changed, 42 insertions, 32 deletions
diff --git a/ChangeLog b/ChangeLog
index cdd722b..ceee623 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,15 @@
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.
Wrap extern symbols in BP_SYM ().
diff --git a/libio/genops.c b/libio/genops.c
index 89a3dfc..82c1c44 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -45,11 +45,11 @@ _IO_un_link (fp)
#ifdef _IO_MTSAFE_IO
_IO_lock_lock (list_all_lock);
#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)
{
- *f = fp->file._chain;
+ *f = (struct _IO_FILE_plus *) fp->file._chain;
break;
}
}
@@ -70,7 +70,7 @@ _IO_link_in (fp)
#ifdef _IO_MTSAFE_IO
_IO_lock_lock (list_all_lock);
#endif
- fp->file._chain = _IO_list_all;
+ fp->file._chain = (_IO_FILE *) _IO_list_all;
_IO_list_all = fp;
#ifdef _IO_MTSAFE_IO
_IO_lock_unlock (list_all_lock);
@@ -746,13 +746,13 @@ int
_IO_flush_all ()
{
int result = 0;
- struct _IO_FILE_plus *fp;
- for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain)
- if (((fp->file._mode < 0 && fp->file._IO_write_ptr > fp->file._IO_write_base)
- || (fp->file._vtable_offset == 0
- && fp->file._mode > 0 && (fp->file._wide_data->_IO_write_ptr
- > fp->file._wide_data->_IO_write_base)))
- && _IO_OVERFLOW (&fp->file, EOF) == EOF)
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if (((fp->_mode < 0 && fp->_IO_write_ptr > fp->_IO_write_base)
+ || (fp->_vtable_offset == 0
+ && fp->_mode > 0 && (fp->_wide_data->_IO_write_ptr
+ > fp->_wide_data->_IO_write_base)))
+ && _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF;
return result;
}
@@ -760,10 +760,10 @@ _IO_flush_all ()
void
_IO_flush_all_linebuffered ()
{
- struct _IO_FILE_plus *fp;
- for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain)
- if ((fp->file._flags & _IO_NO_WRITES) == 0 && fp->file._flags & _IO_LINE_BUF)
- _IO_OVERFLOW (&fp->file, EOF);
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if ((fp->_flags & _IO_NO_WRITES) == 0 && fp->_flags & _IO_LINE_BUF)
+ _IO_OVERFLOW (fp, EOF);
}
static void _IO_unbuffer_write __P ((void));
@@ -771,12 +771,12 @@ static void _IO_unbuffer_write __P ((void));
static void
_IO_unbuffer_write ()
{
- struct _IO_FILE_plus *fp;
- for (fp = _IO_list_all; fp != NULL; fp = fp->file._chain)
- if (! (fp->file._flags & _IO_UNBUFFERED)
- && (! (fp->file._flags & _IO_NO_WRITES)
- || (fp->file._flags & _IO_IS_APPENDING)))
- _IO_SETBUF (&fp->file, NULL, 0);
+ struct _IO_FILE *fp;
+ for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
+ if (! (fp->_flags & _IO_UNBUFFERED)
+ && (! (fp->_flags & _IO_NO_WRITES)
+ || (fp->_flags & _IO_IS_APPENDING)))
+ _IO_SETBUF (fp, NULL, 0);
}
int
@@ -1038,7 +1038,7 @@ _IO_default_imbue (fp, locale)
_IO_ITER
_IO_iter_begin()
{
- return _IO_list_all;
+ return (_IO_ITER) _IO_list_all;
}
_IO_ITER
@@ -1051,14 +1051,14 @@ _IO_ITER
_IO_iter_next(iter)
_IO_ITER iter;
{
- return iter->file._chain;
+ return iter->_chain;
}
_IO_FILE *
_IO_iter_file(iter)
_IO_ITER iter;
{
- return (_IO_FILE *) iter;
+ return iter;
}
void
diff --git a/libio/libio.h b/libio/libio.h
index 6d32eed..0f9a890 100644
--- a/libio/libio.h
+++ b/libio/libio.h
@@ -252,8 +252,6 @@ struct _IO_wide_data
struct _IO_jump_t *_wide_vtable;
};
-struct _IO_FILE_plus;
-
struct _IO_FILE {
int _flags; /* High-order word is _IO_MAGIC; rest is flags. */
#define _IO_file_flags _flags
@@ -275,7 +273,7 @@ struct _IO_FILE {
struct _IO_marker *_markers;
- struct _IO_FILE_plus *_chain;
+ struct _IO_FILE *_chain;
int _fileno;
int _blksize;
@@ -312,6 +310,8 @@ struct _IO_FILE_complete
typedef struct _IO_FILE _IO_FILE;
#endif
+struct _IO_FILE_plus;
+
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_stderr_;
diff --git a/libio/libioP.h b/libio/libioP.h
index 9fb4188..6cc23a6 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -323,7 +323,7 @@ struct _IO_cookie_file
/* 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 */
@@ -708,12 +708,12 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _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 }, &_IO_stdfile_##FD##_lock }
+ 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 }
# else
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _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,\
NULL, WDP, 0 }
# endif
@@ -721,11 +721,12 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list));
# ifdef _IO_USE_OLD_IO_FILE
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _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
# define FILEBUF_LITERAL(CHAIN, FLAGS, FD, WDP) \
{ _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, \
NULL, WDP, 0 }
# endif