about summary refs log tree commit diff
path: root/libio/wgenops.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/wgenops.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/wgenops.c')
-rw-r--r--libio/wgenops.c98
1 files changed, 49 insertions, 49 deletions
diff --git a/libio/wgenops.c b/libio/wgenops.c
index 5ae699c941..e8f5a539ee 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -34,14 +34,14 @@
 #include <wchar.h>
 
 
-static int save_for_wbackup (_IO_FILE *fp, wchar_t *end_p) __THROW;
+static int save_for_wbackup (FILE *fp, wchar_t *end_p) __THROW;
 
 /* Return minimum _pos markers
    Assumes the current get area is the main get area. */
-_IO_ssize_t
-_IO_least_wmarker (_IO_FILE *fp, wchar_t *end_p)
+ssize_t
+_IO_least_wmarker (FILE *fp, wchar_t *end_p)
 {
-  _IO_ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
+  ssize_t least_so_far = end_p - fp->_wide_data->_IO_read_base;
   struct _IO_marker *mark;
   for (mark = fp->_markers; mark != NULL; mark = mark->_next)
     if (mark->_pos < least_so_far)
@@ -52,7 +52,7 @@ libc_hidden_def (_IO_least_wmarker)
 
 /* Switch current get area from backup buffer to (start of) main get area. */
 void
-_IO_switch_to_main_wget_area (_IO_FILE *fp)
+_IO_switch_to_main_wget_area (FILE *fp)
 {
   wchar_t *tmp;
   fp->_flags &= ~_IO_IN_BACKUP;
@@ -72,7 +72,7 @@ libc_hidden_def (_IO_switch_to_main_wget_area)
 
 /* Switch current get area from main get area to (end of) backup area. */
 void
-_IO_switch_to_wbackup_area (_IO_FILE *fp)
+_IO_switch_to_wbackup_area (FILE *fp)
 {
   wchar_t *tmp;
   fp->_flags |= _IO_IN_BACKUP;
@@ -91,7 +91,7 @@ libc_hidden_def (_IO_switch_to_wbackup_area)
 
 
 void
-_IO_wsetb (_IO_FILE *f, wchar_t *b, wchar_t *eb, int a)
+_IO_wsetb (FILE *f, wchar_t *b, wchar_t *eb, int a)
 {
   if (f->_wide_data->_IO_buf_base && !(f->_flags2 & _IO_FLAGS2_USER_WBUF))
     free (f->_wide_data->_IO_buf_base);
@@ -106,7 +106,7 @@ libc_hidden_def (_IO_wsetb)
 
 
 wint_t
-_IO_wdefault_pbackfail (_IO_FILE *fp, wint_t c)
+_IO_wdefault_pbackfail (FILE *fp, wint_t c)
 {
   if (fp->_wide_data->_IO_read_ptr > fp->_wide_data->_IO_read_base
       && !_IO_in_backup (fp)
@@ -145,9 +145,9 @@ _IO_wdefault_pbackfail (_IO_FILE *fp, wint_t c)
       else if (fp->_wide_data->_IO_read_ptr <= fp->_wide_data->_IO_read_base)
 	{
 	  /* Increase size of existing backup buffer. */
-	  _IO_size_t new_size;
-	  _IO_size_t old_size = (fp->_wide_data->_IO_read_end
-				 - fp->_wide_data->_IO_read_base);
+	  size_t new_size;
+	  size_t old_size = (fp->_wide_data->_IO_read_end
+                             - fp->_wide_data->_IO_read_base);
 	  wchar_t *new_buf;
 	  new_size = 2 * old_size;
 	  new_buf = (wchar_t *) malloc (new_size * sizeof (wchar_t));
@@ -169,7 +169,7 @@ libc_hidden_def (_IO_wdefault_pbackfail)
 
 
 void
-_IO_wdefault_finish (_IO_FILE *fp, int dummy)
+_IO_wdefault_finish (FILE *fp, int dummy)
 {
   struct _IO_marker *mark;
   if (fp->_wide_data->_IO_buf_base && !(fp->_flags2 & _IO_FLAGS2_USER_WBUF))
@@ -198,7 +198,7 @@ libc_hidden_def (_IO_wdefault_finish)
 
 
 wint_t
-_IO_wdefault_uflow (_IO_FILE *fp)
+_IO_wdefault_uflow (FILE *fp)
 {
   wint_t wch;
   wch = _IO_UNDERFLOW (fp);
@@ -210,7 +210,7 @@ libc_hidden_def (_IO_wdefault_uflow)
 
 
 wint_t
-__woverflow (_IO_FILE *f, wint_t wch)
+__woverflow (FILE *f, wint_t wch)
 {
   if (f->_mode == 0)
     _IO_fwide (f, 1);
@@ -220,7 +220,7 @@ libc_hidden_def (__woverflow)
 
 
 wint_t
-__wuflow (_IO_FILE *fp)
+__wuflow (FILE *fp)
 {
   if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
     return WEOF;
@@ -250,7 +250,7 @@ __wuflow (_IO_FILE *fp)
 libc_hidden_def (__wuflow)
 
 wint_t
-__wunderflow (_IO_FILE *fp)
+__wunderflow (FILE *fp)
 {
   if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
     return WEOF;
@@ -280,21 +280,21 @@ __wunderflow (_IO_FILE *fp)
 libc_hidden_def (__wunderflow)
 
 
-_IO_size_t
-_IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
+size_t
+_IO_wdefault_xsputn (FILE *f, const void *data, size_t n)
 {
   const wchar_t *s = (const wchar_t *) data;
-  _IO_size_t more = n;
+  size_t more = n;
   if (more <= 0)
     return 0;
   for (;;)
     {
       /* Space available. */
-      _IO_ssize_t count = (f->_wide_data->_IO_write_end
-			   - f->_wide_data->_IO_write_ptr);
+      ssize_t count = (f->_wide_data->_IO_write_end
+                       - f->_wide_data->_IO_write_ptr);
       if (count > 0)
 	{
-	  if ((_IO_size_t) count > more)
+	  if ((size_t) count > more)
 	    count = more;
 	  if (count > 20)
 	    {
@@ -307,7 +307,7 @@ _IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 	  else
 	    {
 	      wchar_t *p = f->_wide_data->_IO_write_ptr;
-	      _IO_ssize_t i;
+	      ssize_t i;
 	      for (i = count; --i >= 0; )
 		*p++ = *s++;
 	      f->_wide_data->_IO_write_ptr = p;
@@ -323,19 +323,19 @@ _IO_wdefault_xsputn (_IO_FILE *f, const void *data, _IO_size_t n)
 libc_hidden_def (_IO_wdefault_xsputn)
 
 
-_IO_size_t
-_IO_wdefault_xsgetn (_IO_FILE *fp, void *data, _IO_size_t n)
+size_t
+_IO_wdefault_xsgetn (FILE *fp, void *data, size_t n)
 {
-  _IO_size_t more = n;
+  size_t more = n;
   wchar_t *s = (wchar_t*) data;
   for (;;)
     {
       /* Data available. */
-      _IO_ssize_t count = (fp->_wide_data->_IO_read_end
-			   - fp->_wide_data->_IO_read_ptr);
+      ssize_t count = (fp->_wide_data->_IO_read_end
+                       - fp->_wide_data->_IO_read_ptr);
       if (count > 0)
 	{
-	  if ((_IO_size_t) count > more)
+	  if ((size_t) count > more)
 	    count = more;
 	  if (count > 20)
 	    {
@@ -363,7 +363,7 @@ libc_hidden_def (_IO_wdefault_xsgetn)
 
 
 void
-_IO_wdoallocbuf (_IO_FILE *fp)
+_IO_wdoallocbuf (FILE *fp)
 {
   if (fp->_wide_data->_IO_buf_base)
     return;
@@ -377,21 +377,21 @@ libc_hidden_def (_IO_wdoallocbuf)
 
 
 int
-_IO_wdefault_doallocate (_IO_FILE *fp)
+_IO_wdefault_doallocate (FILE *fp)
 {
   wchar_t *buf;
 
-  buf = malloc (_IO_BUFSIZ);
+  buf = malloc (BUFSIZ);
   if (__glibc_unlikely (buf == NULL))
     return EOF;
-  _IO_wsetb (fp, buf, buf + _IO_BUFSIZ, 1);
+  _IO_wsetb (fp, buf, buf + BUFSIZ, 1);
   return 1;
 }
 libc_hidden_def (_IO_wdefault_doallocate)
 
 
 int
-_IO_switch_to_wget_mode (_IO_FILE *fp)
+_IO_switch_to_wget_mode (FILE *fp)
 {
   if (fp->_wide_data->_IO_write_ptr > fp->_wide_data->_IO_write_base)
     if ((wint_t)_IO_WOVERFLOW (fp, WEOF) == WEOF)
@@ -415,7 +415,7 @@ _IO_switch_to_wget_mode (_IO_FILE *fp)
 libc_hidden_def (_IO_switch_to_wget_mode)
 
 void
-_IO_free_wbackup_area (_IO_FILE *fp)
+_IO_free_wbackup_area (FILE *fp)
 {
   if (_IO_in_backup (fp))
     _IO_switch_to_main_wget_area (fp);  /* Just in case. */
@@ -428,7 +428,7 @@ libc_hidden_def (_IO_free_wbackup_area)
 
 #if 0
 int
-_IO_switch_to_wput_mode (_IO_FILE *fp)
+_IO_switch_to_wput_mode (FILE *fp)
 {
   fp->_wide_data->_IO_write_base = fp->_wide_data->_IO_read_ptr;
   fp->_wide_data->_IO_write_ptr = fp->_wide_data->_IO_read_ptr;
@@ -447,18 +447,18 @@ _IO_switch_to_wput_mode (_IO_FILE *fp)
 
 
 static int
-save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
+save_for_wbackup (FILE *fp, wchar_t *end_p)
 {
   /* Append [_IO_read_base..end_p] to backup area. */
-  _IO_ssize_t least_mark = _IO_least_wmarker (fp, end_p);
+  ssize_t least_mark = _IO_least_wmarker (fp, end_p);
   /* needed_size is how much space we need in the backup area. */
-  _IO_size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
-			    - least_mark);
+  size_t needed_size = ((end_p - fp->_wide_data->_IO_read_base)
+                        - least_mark);
   /* FIXME: Dubious arithmetic if pointers are NULL */
-  _IO_size_t current_Bsize = (fp->_wide_data->_IO_save_end
-			      - fp->_wide_data->_IO_save_base);
-  _IO_size_t avail; /* Extra space available for future expansion. */
-  _IO_ssize_t delta;
+  size_t current_Bsize = (fp->_wide_data->_IO_save_end
+                          - fp->_wide_data->_IO_save_base);
+  size_t avail; /* Extra space available for future expansion. */
+  ssize_t delta;
   struct _IO_marker *mark;
   if (needed_size > current_Bsize)
     {
@@ -512,7 +512,7 @@ save_for_wbackup (_IO_FILE *fp, wchar_t *end_p)
 }
 
 wint_t
-_IO_sputbackwc (_IO_FILE *fp, wint_t c)
+_IO_sputbackwc (FILE *fp, wint_t c)
 {
   wint_t result;
 
@@ -533,7 +533,7 @@ _IO_sputbackwc (_IO_FILE *fp, wint_t c)
 libc_hidden_def (_IO_sputbackwc)
 
 wint_t
-_IO_sungetwc (_IO_FILE *fp)
+_IO_sungetwc (FILE *fp)
 {
   wint_t result;
 
@@ -563,7 +563,7 @@ _IO_adjust_wcolumn (unsigned start, const wchar_t *line, int count)
 }
 
 void
-_IO_init_wmarker (struct _IO_marker *marker, _IO_FILE *fp)
+_IO_init_wmarker (struct _IO_marker *marker, FILE *fp)
 {
   marker->_sbuf = fp;
   if (_IO_in_put_mode (fp))
@@ -598,7 +598,7 @@ _IO_wmarker_delta (struct _IO_marker *mark)
 }
 
 int
-_IO_seekwmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
+_IO_seekwmark (FILE *fp, struct _IO_marker *mark, int delta)
 {
   if (mark->_sbuf != fp)
     return EOF;
@@ -619,7 +619,7 @@ _IO_seekwmark (_IO_FILE *fp, struct _IO_marker *mark, int delta)
 }
 
 void
-_IO_unsave_wmarkers (_IO_FILE *fp)
+_IO_unsave_wmarkers (FILE *fp)
 {
   struct _IO_marker *mark = fp->_markers;
   if (mark)