about summary refs log tree commit diff
path: root/libio/oldfileops.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2018-02-07 18:42:04 -0500
committerZack Weinberg <zackw@panix.com>2018-02-21 14:11:05 -0500
commit9964a14579e5eef925aaa82facc4980f627802fe (patch)
tree10bab616fb792754708552ee49a3cd914f9c167e /libio/oldfileops.c
parent349579047db0fb55a2835ca20dfd646a45b6ac27 (diff)
downloadglibc-9964a14579e5eef925aaa82facc4980f627802fe.tar.gz
glibc-9964a14579e5eef925aaa82facc4980f627802fe.tar.xz
glibc-9964a14579e5eef925aaa82facc4980f627802fe.zip
Mechanically remove _IO_ name aliases for types and constants.
This patch mechanically removes all remaining uses, and the
definitions, of the following libio name aliases:

 name                         replaced with
 ----                         -------------
 _IO_FILE                     FILE
 _IO_fpos_t                   __fpos_t
 _IO_fpos64_t                 __fpos64_t
 _IO_size_t                   size_t
 _IO_ssize_t                  ssize_t or __ssize_t
 _IO_off_t                    off_t
 _IO_off64_t                  off64_t
 _IO_pid_t                    pid_t
 _IO_uid_t                    uid_t
 _IO_wint_t                   wint_t
 _IO_va_list                  va_list or __gnuc_va_list
 _IO_BUFSIZ                   BUFSIZ
 _IO_cookie_io_functions_t    cookie_io_functions_t
 __io_read_fn                 cookie_read_function_t
 __io_write_fn                cookie_write_function_t
 __io_seek_fn                 cookie_seek_function_t
 __io_close_fn                cookie_close_function_t

I used __fpos_t and __fpos64_t instead of fpos_t and fpos64_t because
the definitions of fpos_t and fpos64_t depend on the largefile mode.
I used __ssize_t and __gnuc_va_list in a handful of headers where
namespace cleanliness might be relevant even though they're
internal-use-only.  In all other cases, I used the public-namespace
name.

There are a tiny handful of places where I left a use of 'struct _IO_FILE'
alone, because it was being used together with 'struct _IO_FILE_plus'
or 'struct _IO_FILE_complete' in the same arithmetic expression.

Because this patch was almost entirely done with search and replace, I
may have introduced indentation botches.  I did proofread the diff,
but I may have missed something.

The ChangeLog below calls out all of the places where this was not a
pure search-and-replace change.

Installed stripped libraries and executables are unchanged by this patch,
except that some assertions in vfscanf.c change line numbers.

	* libio/libio.h (_IO_FILE): Delete; all uses changed to FILE.
	(_IO_fpos_t): Delete; all uses changed to __fpos_t.
	(_IO_fpos64_t): Delete; all uses changed to __fpos64_t.
	(_IO_size_t): Delete; all uses changed to size_t.
	(_IO_ssize_t): Delete; all uses changed to ssize_t or __ssize_t.
	(_IO_off_t): Delete; all uses changed to off_t.
	(_IO_off64_t): Delete; all uses changed to off64_t.
	(_IO_pid_t): Delete; all uses changed to pid_t.
	(_IO_uid_t): Delete; all uses changed to uid_t.
	(_IO_wint_t): Delete; all uses changed to wint_t.
	(_IO_va_list): Delete; all uses changed to va_list or __gnuc_va_list.
	(_IO_BUFSIZ): Delete; all uses changed to BUFSIZ.
	(_IO_cookie_io_functions_t): Delete; all uses changed to
	cookie_io_functions_t.
	(__io_read_fn): Delete; all uses changed to cookie_read_function_t.
	(__io_write_fn): Delete; all uses changed to cookie_write_function_t.
	(__io_seek_fn): Delete; all uses changed to cookie_seek_function_t.
	(__io_close_fn): Delete: all uses changed to cookie_close_function_t.

	* libio/iofopncook.c: Remove unnecessary forward declarations.
	* libio/iolibio.h: Correct outdated commentary.
	* malloc/malloc.c (__malloc_stats): Remove unnecessary casts.
	* stdio-common/fxprintf.c (__fxprintf_nocancel):
	Remove unnecessary casts.
	* stdio-common/getline.c: Use _IO_getdelim directly.
	Don't redefine ssize_t.
	* stdio-common/printf_fp.c, stdio_common/printf_fphex.c
	* stdio-common/printf_size.c: Don't redefine size_t or FILE.
	Remove outdated comments.
	* stdio-common/vfscanf.c: Don't redefine va_list.
Diffstat (limited to 'libio/oldfileops.c')
-rw-r--r--libio/oldfileops.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index f00f6cb979..e824a64bba 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -128,7 +128,7 @@ _IO_old_file_init (struct _IO_FILE_plus *fp)
 
 int
 attribute_compat_text_section
-_IO_old_file_close_it (_IO_FILE *fp)
+_IO_old_file_close_it (FILE *fp)
 {
   int write_status, close_status;
   if (!_IO_file_is_open (fp))
@@ -156,7 +156,7 @@ _IO_old_file_close_it (_IO_FILE *fp)
 
 void
 attribute_compat_text_section
-_IO_old_file_finish (_IO_FILE *fp, int dummy)
+_IO_old_file_finish (FILE *fp, int dummy)
 {
   if (_IO_file_is_open (fp))
     {
@@ -167,9 +167,9 @@ _IO_old_file_finish (_IO_FILE *fp, int dummy)
   _IO_default_finish (fp, 0);
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode)
+_IO_old_file_fopen (FILE *fp, const char *filename, const char *mode)
 {
   int oflags = 0, omode;
   int read_write, fdesc;
@@ -207,16 +207,16 @@ _IO_old_file_fopen (_IO_FILE *fp, const char *filename, const char *mode)
   fp->_fileno = fdesc;
   _IO_mask_flags (fp, read_write,_IO_NO_READS+_IO_NO_WRITES+_IO_IS_APPENDING);
   if (read_write & _IO_IS_APPENDING)
-    if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
+    if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_end, _IOS_INPUT|_IOS_OUTPUT)
 	== _IO_pos_BAD && errno != ESPIPE)
       return NULL;
   _IO_link_in ((struct _IO_FILE_plus *) fp);
   return fp;
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_attach (_IO_FILE *fp, int fd)
+_IO_old_file_attach (FILE *fp, int fd)
 {
   if (_IO_file_is_open (fp))
     return NULL;
@@ -226,15 +226,15 @@ _IO_old_file_attach (_IO_FILE *fp, int fd)
   /* Get the current position of the file. */
   /* We have to do that since that may be junk. */
   fp->_old_offset = _IO_pos_BAD;
-  if (_IO_SEEKOFF (fp, (_IO_off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
+  if (_IO_SEEKOFF (fp, (off_t)0, _IO_seek_cur, _IOS_INPUT|_IOS_OUTPUT)
       == _IO_pos_BAD && errno != ESPIPE)
     return NULL;
   return fp;
 }
 
-_IO_FILE *
+FILE *
 attribute_compat_text_section
-_IO_old_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
+_IO_old_file_setbuf (FILE *fp, char *p, ssize_t len)
 {
     if (_IO_default_setbuf (fp, p, len) == NULL)
       return NULL;
@@ -246,24 +246,24 @@ _IO_old_file_setbuf (_IO_FILE *fp, char *p, _IO_ssize_t len)
     return fp;
 }
 
-static int old_do_write (_IO_FILE *, const char *, _IO_size_t);
+static int old_do_write (FILE *, const char *, size_t);
 
 /* Write TO_DO bytes from DATA to FP.
    Then mark FP as having empty buffers. */
 
 int
 attribute_compat_text_section
-_IO_old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+_IO_old_do_write (FILE *fp, const char *data, size_t to_do)
 {
-  return (to_do == 0 || (_IO_size_t) old_do_write (fp, data, to_do) == to_do)
+  return (to_do == 0 || (size_t) old_do_write (fp, data, to_do) == to_do)
 	 ? 0 : EOF;
 }
 
 static int
 attribute_compat_text_section
-old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
+old_do_write (FILE *fp, const char *data, size_t to_do)
 {
-  _IO_size_t count;
+  size_t count;
   if (fp->_flags & _IO_IS_APPENDING)
     /* On a system without a proper O_APPEND implementation,
        you would need to sys_seek(0, SEEK_END) here, but is
@@ -273,7 +273,7 @@ old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
     fp->_old_offset = _IO_pos_BAD;
   else if (fp->_IO_read_end != fp->_IO_write_base)
     {
-      _IO_off_t new_pos
+      off_t new_pos
 	= _IO_SYSSEEK (fp, fp->_IO_write_base - fp->_IO_read_end, 1);
       if (new_pos == _IO_pos_BAD)
 	return 0;
@@ -291,9 +291,9 @@ old_do_write (_IO_FILE *fp, const char *data, _IO_size_t to_do)
 
 int
 attribute_compat_text_section
-_IO_old_file_underflow (_IO_FILE *fp)
+_IO_old_file_underflow (FILE *fp)
 {
-  _IO_ssize_t count;
+  ssize_t count;
 #if 0
   /* SysV does not make this test; take it out for compatibility */
   if (fp->_flags & _IO_EOF_SEEN)
@@ -355,7 +355,7 @@ _IO_old_file_underflow (_IO_FILE *fp)
 
 int
 attribute_compat_text_section
-_IO_old_file_overflow (_IO_FILE *f, int ch)
+_IO_old_file_overflow (FILE *f, int ch)
 {
   if (f->_flags & _IO_NO_WRITES) /* SET ERROR */
     {
@@ -405,9 +405,9 @@ _IO_old_file_overflow (_IO_FILE *f, int ch)
 
 int
 attribute_compat_text_section
-_IO_old_file_sync (_IO_FILE *fp)
+_IO_old_file_sync (FILE *fp)
 {
-  _IO_ssize_t delta;
+  ssize_t delta;
   int retval = 0;
 
   /*    char* ptr = cur_ptr(); */
@@ -420,8 +420,8 @@ _IO_old_file_sync (_IO_FILE *fp)
       if (_IO_in_backup (fp))
 	delta -= eGptr () - Gbase ();
 #endif
-      _IO_off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
-      if (new_pos != (_IO_off_t) EOF)
+      off_t new_pos = _IO_SYSSEEK (fp, delta, 1);
+      if (new_pos != (off_t) EOF)
 	fp->_IO_read_end = fp->_IO_read_ptr;
       else if (errno == ESPIPE)
 	; /* Ignore error from unseekable devices. */
@@ -435,12 +435,12 @@ _IO_old_file_sync (_IO_FILE *fp)
   return retval;
 }
 
-_IO_off64_t
+off64_t
 attribute_compat_text_section
-_IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
+_IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
 {
-  _IO_off_t result;
-  _IO_off64_t delta, new_offset;
+  off_t result;
+  off64_t delta, new_offset;
   long count;
   /* POSIX.1 8.2.3.7 says that after a call the fflush() the file
      offset of the underlying file must be exact.  */
@@ -512,8 +512,8 @@ _IO_old_file_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode)
       && !_IO_in_backup (fp))
     {
       /* Offset relative to start of main get area. */
-      _IO_off_t rel_offset = (offset - fp->_old_offset
-			      + (fp->_IO_read_end - fp->_IO_read_base));
+      off_t rel_offset = (offset - fp->_old_offset
+                          + (fp->_IO_read_end - fp->_IO_read_base));
       if (rel_offset >= 0)
 	{
 #if 0
@@ -618,14 +618,14 @@ resync:
   return offset;
 }
 
-_IO_ssize_t
+ssize_t
 attribute_compat_text_section
-_IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
+_IO_old_file_write (FILE *f, const void *data, ssize_t n)
 {
-  _IO_ssize_t to_do = n;
+  ssize_t to_do = n;
   while (to_do > 0)
     {
-      _IO_ssize_t count = __write (f->_fileno, data, to_do);
+      ssize_t count = __write (f->_fileno, data, to_do);
       if (count == EOF)
 	{
 	  f->_flags |= _IO_ERR_SEEN;
@@ -640,14 +640,14 @@ _IO_old_file_write (_IO_FILE *f, const void *data, _IO_ssize_t n)
   return n;
 }
 
-_IO_size_t
+size_t
 attribute_compat_text_section
-_IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+_IO_old_file_xsputn (FILE *f, const void *data, size_t n)
 {
   const char *s = (char *) data;
-  _IO_size_t to_do = n;
+  size_t to_do = n;
   int must_flush = 0;
-  _IO_size_t count = 0;
+  size_t count = 0;
 
   if (n <= 0)
     return 0;
@@ -698,7 +698,7 @@ _IO_old_file_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
     }
   if (to_do + must_flush > 0)
     {
-      _IO_size_t block_size, do_write;
+      size_t block_size, do_write;
       /* Next flush the (full) buffer. */
       if (__overflow (f, EOF) == EOF)
 	return to_do == 0 ? EOF : n - to_do;