From 9964a14579e5eef925aaa82facc4980f627802fe Mon Sep 17 00:00:00 2001 From: Zack Weinberg Date: Wed, 7 Feb 2018 18:42:04 -0500 Subject: 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. --- libio/strops.c | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'libio/strops.c') diff --git a/libio/strops.c b/libio/strops.c index ac995c8..adfa807 100644 --- a/libio/strops.c +++ b/libio/strops.c @@ -31,15 +31,15 @@ #include void -_IO_str_init_static_internal (_IO_strfile *sf, char *ptr, _IO_size_t size, +_IO_str_init_static_internal (_IO_strfile *sf, char *ptr, size_t size, char *pstart) { - _IO_FILE *fp = &sf->_sbf._f; + FILE *fp = &sf->_sbf._f; char *end; if (size == 0) end = __rawmemchr (ptr, '\0'); - else if ((_IO_size_t) ptr + size > (_IO_size_t) ptr) + else if ((size_t) ptr + size > (size_t) ptr) end = ptr + size; else end = (char *) -1; @@ -78,10 +78,10 @@ _IO_str_init_readonly (_IO_strfile *sf, const char *ptr, int size) } int -_IO_str_overflow (_IO_FILE *fp, int c) +_IO_str_overflow (FILE *fp, int c) { int flush_only = c == EOF; - _IO_size_t pos; + size_t pos; if (fp->_flags & _IO_NO_WRITES) return flush_only ? 0 : EOF; if ((fp->_flags & _IO_TIED_PUT_GET) && !(fp->_flags & _IO_CURRENTLY_PUTTING)) @@ -91,7 +91,7 @@ _IO_str_overflow (_IO_FILE *fp, int c) fp->_IO_read_ptr = fp->_IO_read_end; } pos = fp->_IO_write_ptr - fp->_IO_write_base; - if (pos >= (_IO_size_t) (_IO_blen (fp) + flush_only)) + if (pos >= (size_t) (_IO_blen (fp) + flush_only)) { if (fp->_flags & _IO_USER_BUF) /* not allowed to enlarge */ return EOF; @@ -100,7 +100,7 @@ _IO_str_overflow (_IO_FILE *fp, int c) char *new_buf; char *old_buf = fp->_IO_buf_base; size_t old_blen = _IO_blen (fp); - _IO_size_t new_size = 2 * old_blen + 100; + size_t new_size = 2 * old_blen + 100; if (new_size < old_blen) return EOF; new_buf @@ -139,7 +139,7 @@ _IO_str_overflow (_IO_FILE *fp, int c) libc_hidden_def (_IO_str_overflow) int -_IO_str_underflow (_IO_FILE *fp) +_IO_str_underflow (FILE *fp) { if (fp->_IO_write_ptr > fp->_IO_read_end) fp->_IO_read_end = fp->_IO_write_ptr; @@ -158,8 +158,8 @@ libc_hidden_def (_IO_str_underflow) /* The size of the valid part of the buffer. */ -_IO_ssize_t -_IO_str_count (_IO_FILE *fp) +ssize_t +_IO_str_count (FILE *fp) { return ((fp->_IO_write_ptr > fp->_IO_read_end ? fp->_IO_write_ptr : fp->_IO_read_end) @@ -168,19 +168,19 @@ _IO_str_count (_IO_FILE *fp) static int -enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) +enlarge_userbuf (FILE *fp, off64_t offset, int reading) { - if ((_IO_ssize_t) offset <= _IO_blen (fp)) + if ((ssize_t) offset <= _IO_blen (fp)) return 0; - _IO_ssize_t oldend = fp->_IO_write_end - fp->_IO_write_base; + ssize_t oldend = fp->_IO_write_end - fp->_IO_write_base; /* Try to enlarge the buffer. */ if (fp->_flags & _IO_USER_BUF) /* User-provided buffer. */ return 1; - _IO_size_t newsize = offset + 100; + size_t newsize = offset + 100; char *oldbuf = fp->_IO_buf_base; char *newbuf = (char *) (*((_IO_strfile *) fp)->_s._allocate_buffer) (newsize); @@ -231,7 +231,7 @@ enlarge_userbuf (_IO_FILE *fp, _IO_off64_t offset, int reading) } static void -_IO_str_switch_to_get_mode (_IO_FILE *fp) +_IO_str_switch_to_get_mode (FILE *fp) { if (_IO_in_backup (fp)) fp->_IO_read_base = fp->_IO_backup_base; @@ -246,10 +246,10 @@ _IO_str_switch_to_get_mode (_IO_FILE *fp) fp->_flags &= ~_IO_CURRENTLY_PUTTING; } -_IO_off64_t -_IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) +off64_t +_IO_str_seekoff (FILE *fp, off64_t offset, int dir, int mode) { - _IO_off64_t new_pos; + off64_t new_pos; if (mode == 0 && (fp->_flags & _IO_TIED_PUT_GET)) mode = (fp->_flags & _IO_CURRENTLY_PUTTING ? _IOS_OUTPUT : _IOS_INPUT); @@ -265,13 +265,13 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) } else { - _IO_ssize_t cur_size = _IO_str_count(fp); + ssize_t cur_size = _IO_str_count(fp); new_pos = EOF; /* Move the get pointer, if requested. */ if (mode & _IOS_INPUT) { - _IO_ssize_t base; + ssize_t base; switch (dir) { case _IO_seek_set: @@ -284,7 +284,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) base = cur_size; break; } - _IO_ssize_t maxval = SSIZE_MAX - base; + ssize_t maxval = SSIZE_MAX - base; if (offset < -base || offset > maxval) { __set_errno (EINVAL); @@ -302,7 +302,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) /* Move the put pointer, if requested. */ if (mode & _IOS_OUTPUT) { - _IO_ssize_t base; + ssize_t base; switch (dir) { case _IO_seek_set: @@ -315,7 +315,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) base = cur_size; break; } - _IO_ssize_t maxval = SSIZE_MAX - base; + ssize_t maxval = SSIZE_MAX - base; if (offset < -base || offset > maxval) { __set_errno (EINVAL); @@ -334,7 +334,7 @@ _IO_str_seekoff (_IO_FILE *fp, _IO_off64_t offset, int dir, int mode) libc_hidden_def (_IO_str_seekoff) int -_IO_str_pbackfail (_IO_FILE *fp, int c) +_IO_str_pbackfail (FILE *fp, int c) { if ((fp->_flags & _IO_NO_WRITES) && c != EOF) return EOF; @@ -343,7 +343,7 @@ _IO_str_pbackfail (_IO_FILE *fp, int c) libc_hidden_def (_IO_str_pbackfail) void -_IO_str_finish (_IO_FILE *fp, int dummy) +_IO_str_finish (FILE *fp, int dummy) { if (fp->_IO_buf_base && !(fp->_flags & _IO_USER_BUF)) (((_IO_strfile *) fp)->_s._free_buffer) (fp->_IO_buf_base); -- cgit v1.1