1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Remove use of INTDEF/INTUSE in libio

This commit is contained in:
Andreas Schwab
2012-05-23 13:33:15 +02:00
parent c14874927b
commit d18ea0c5e6
98 changed files with 801 additions and 729 deletions

View File

@ -60,8 +60,6 @@ extern int errno;
# define lseek(FD, Offset, Whence) __lseek (FD, Offset, Whence)
# define read(FD, Buf, NBytes) __read (FD, Buf, NBytes)
# define write(FD, Buf, NBytes) __write (FD, Buf, NBytes)
# define _IO_do_write _IO_new_do_write /* For macro uses. */
# define _IO_file_close_it _IO_new_file_close_it
#else
# define _IO_new_do_write _IO_do_write
# define _IO_new_file_attach _IO_file_attach
@ -148,10 +146,10 @@ _IO_new_file_init (fp)
fp->file._offset = _IO_pos_BAD;
fp->file._IO_file_flags |= CLOSED_FILEBUF_FLAGS;
INTUSE(_IO_link_in) (fp);
_IO_link_in (fp);
fp->file._fileno = -1;
}
INTDEF2(_IO_new_file_init, _IO_file_init)
libc_hidden_ver (_IO_new_file_init, _IO_file_init)
int
_IO_new_file_close_it (fp)
@ -175,7 +173,7 @@ _IO_new_file_close_it (fp)
else
write_status = 0;
INTUSE(_IO_unsave_markers) (fp);
_IO_unsave_markers (fp);
int close_status = ((fp->_flags2 & _IO_FLAGS2_NOCLOSE) == 0
? _IO_SYSCLOSE (fp) : 0);
@ -185,24 +183,24 @@ _IO_new_file_close_it (fp)
if (fp->_mode > 0)
{
if (_IO_have_wbackup (fp))
INTUSE(_IO_free_wbackup_area) (fp);
INTUSE(_IO_wsetb) (fp, NULL, NULL, 0);
_IO_free_wbackup_area (fp);
_IO_wsetb (fp, NULL, NULL, 0);
_IO_wsetg (fp, NULL, NULL, NULL);
_IO_wsetp (fp, NULL, NULL);
}
#endif
INTUSE(_IO_setb) (fp, NULL, NULL, 0);
_IO_setb (fp, NULL, NULL, 0);
_IO_setg (fp, NULL, NULL, NULL);
_IO_setp (fp, NULL, NULL);
INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp);
_IO_un_link ((struct _IO_FILE_plus *) fp);
fp->_flags = _IO_MAGIC|CLOSED_FILEBUF_FLAGS;
fp->_fileno = -1;
fp->_offset = _IO_pos_BAD;
return close_status ? close_status : write_status;
}
INTDEF2(_IO_new_file_close_it, _IO_file_close_it)
libc_hidden_ver (_IO_new_file_close_it, _IO_file_close_it)
void
_IO_new_file_finish (fp, dummy)
@ -215,9 +213,9 @@ _IO_new_file_finish (fp, dummy)
if (!(fp->_flags & _IO_DELETE_DONT_CLOSE))
_IO_SYSCLOSE (fp);
}
INTUSE(_IO_default_finish) (fp, 0);
_IO_default_finish (fp, 0);
}
INTDEF2(_IO_new_file_finish, _IO_file_finish)
libc_hidden_ver (_IO_new_file_finish, _IO_file_finish)
_IO_FILE *
_IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
@ -249,7 +247,7 @@ _IO_file_open (fp, filename, posix_mode, prot, read_write, is32not64)
close_not_cancel (fdesc);
return NULL;
}
INTUSE(_IO_link_in) ((struct _IO_FILE_plus *) fp);
_IO_link_in ((struct _IO_FILE_plus *) fp);
return fp;
}
libc_hidden_def (_IO_file_open)
@ -378,7 +376,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
/* Something went wrong, we cannot load the conversion modules.
This means we cannot proceed since the user explicitly asked
for these. */
(void) INTUSE(_IO_file_close_it) (fp);
(void) _IO_file_close_it (fp);
__set_errno (EINVAL);
return NULL;
}
@ -431,7 +429,7 @@ _IO_new_file_fopen (fp, filename, mode, is32not64)
return result;
}
INTDEF2(_IO_new_file_fopen, _IO_file_fopen)
libc_hidden_ver (_IO_new_file_fopen, _IO_file_fopen)
_IO_FILE *
_IO_new_file_attach (fp, fd)
@ -453,7 +451,7 @@ _IO_new_file_attach (fp, fd)
__set_errno (save_errno);
return fp;
}
INTDEF2(_IO_new_file_attach, _IO_file_attach)
libc_hidden_ver (_IO_new_file_attach, _IO_file_attach)
_IO_FILE *
_IO_new_file_setbuf (fp, p, len)
@ -470,7 +468,7 @@ _IO_new_file_setbuf (fp, p, len)
return fp;
}
INTDEF2(_IO_new_file_setbuf, _IO_file_setbuf)
libc_hidden_ver (_IO_new_file_setbuf, _IO_file_setbuf)
_IO_FILE *
@ -512,7 +510,7 @@ _IO_new_do_write (fp, data, to_do)
return (to_do == 0
|| (_IO_size_t) new_do_write (fp, data, to_do) == to_do) ? 0 : EOF;
}
INTDEF2(_IO_new_do_write, _IO_do_write)
libc_hidden_ver (_IO_new_do_write, _IO_do_write)
static
_IO_size_t
@ -539,8 +537,7 @@ new_do_write (fp, data, to_do)
}
count = _IO_SYSWRITE (fp, data, to_do);
if (fp->_cur_column && count)
fp->_cur_column = INTUSE(_IO_adjust_column) (fp->_cur_column - 1, data,
count) + 1;
fp->_cur_column = _IO_adjust_column (fp->_cur_column - 1, data, count) + 1;
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_buf_base;
fp->_IO_write_end = (fp->_mode <= 0
@ -577,7 +574,7 @@ _IO_new_file_underflow (fp)
free (fp->_IO_save_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
INTUSE(_IO_doallocbuf) (fp);
_IO_doallocbuf (fp);
}
/* Flush all line buffered files before reading. */
@ -585,7 +582,7 @@ _IO_new_file_underflow (fp)
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
{
#if 0
INTUSE(_IO_flush_all_linebuffered) ();
_IO_flush_all_linebuffered ();
#else
/* We used to flush all line-buffered stream. This really isn't
required by any standard. My recollection is that
@ -602,7 +599,7 @@ _IO_new_file_underflow (fp)
#endif
}
INTUSE(_IO_switch_to_get_mode) (fp);
_IO_switch_to_get_mode (fp);
/* This is very tricky. We have to adjust those
pointers before we call _IO_SYSREAD () since
@ -629,7 +626,7 @@ _IO_new_file_underflow (fp)
_IO_pos_adjust (fp->_offset, count);
return *(unsigned char *) fp->_IO_read_ptr;
}
INTDEF2(_IO_new_file_underflow, _IO_file_underflow)
libc_hidden_ver (_IO_new_file_underflow, _IO_file_underflow)
/* Guts of underflow callback if we mmap the file. This stats the file and
updates the stream state to match. In the normal case we return zero.
@ -802,7 +799,7 @@ decide_maybe_mmap (_IO_FILE *fp)
}
else
{
INTUSE(_IO_setb) (fp, p, (char *) p + st.st_size, 0);
_IO_setb (fp, p, (char *) p + st.st_size, 0);
if (fp->_offset == _IO_pos_BAD)
fp->_offset = 0;
@ -857,7 +854,7 @@ _IO_new_file_overflow (f, ch)
/* Allocate a buffer if needed. */
if (f->_IO_write_base == NULL)
{
INTUSE(_IO_doallocbuf) (f);
_IO_doallocbuf (f);
_IO_setg (f, f->_IO_buf_base, f->_IO_buf_base, f->_IO_buf_base);
}
/* Otherwise must be currently reading.
@ -870,7 +867,7 @@ _IO_new_file_overflow (f, ch)
if (__builtin_expect (_IO_in_backup (f), 0))
{
size_t nbackup = f->_IO_read_end - f->_IO_read_ptr;
INTUSE(_IO_free_backup_area) (f);
_IO_free_backup_area (f);
f->_IO_read_base -= MIN (nbackup,
f->_IO_read_base - f->_IO_buf_base);
f->_IO_read_ptr = f->_IO_read_base;
@ -888,20 +885,20 @@ _IO_new_file_overflow (f, ch)
f->_IO_write_end = f->_IO_write_ptr;
}
if (ch == EOF)
return INTUSE(_IO_do_write) (f, f->_IO_write_base,
f->_IO_write_ptr - f->_IO_write_base);
return _IO_do_write (f, f->_IO_write_base,
f->_IO_write_ptr - f->_IO_write_base);
if (f->_IO_write_ptr == f->_IO_buf_end ) /* Buffer is really full */
if (_IO_do_flush (f) == EOF)
return EOF;
*f->_IO_write_ptr++ = ch;
if ((f->_flags & _IO_UNBUFFERED)
|| ((f->_flags & _IO_LINE_BUF) && ch == '\n'))
if (INTUSE(_IO_do_write) (f, f->_IO_write_base,
f->_IO_write_ptr - f->_IO_write_base) == EOF)
if (_IO_do_write (f, f->_IO_write_base,
f->_IO_write_ptr - f->_IO_write_base) == EOF)
return EOF;
return (unsigned char) ch;
}
INTDEF2(_IO_new_file_overflow, _IO_file_overflow)
libc_hidden_ver (_IO_new_file_overflow, _IO_file_overflow)
int
_IO_new_file_sync (fp)
@ -936,7 +933,7 @@ _IO_new_file_sync (fp)
/* setg(base(), ptr, ptr); */
return retval;
}
INTDEF2(_IO_new_file_sync, _IO_file_sync)
libc_hidden_ver (_IO_new_file_sync, _IO_file_sync)
static int
_IO_file_sync_mmap (_IO_FILE *fp)
@ -993,7 +990,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
FIXME: simulate mem-papped files. */
if (fp->_IO_write_ptr > fp->_IO_write_base || _IO_in_put_mode (fp))
if (INTUSE(_IO_switch_to_get_mode) (fp))
if (_IO_switch_to_get_mode (fp))
return EOF;
if (fp->_IO_buf_base == NULL)
@ -1004,7 +1001,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
free (fp->_IO_read_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
INTUSE(_IO_doallocbuf) (fp);
_IO_doallocbuf (fp);
_IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base, fp->_IO_buf_base);
}
@ -1112,7 +1109,7 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
return offset;
dumb:
INTUSE(_IO_unsave_markers) (fp);
_IO_unsave_markers (fp);
result = _IO_SYSSEEK (fp, offset, dir);
if (result != EOF)
{
@ -1133,7 +1130,7 @@ resync:
return offset;
}
INTDEF2(_IO_new_file_seekoff, _IO_file_seekoff)
libc_hidden_ver (_IO_new_file_seekoff, _IO_file_seekoff)
_IO_off64_t
_IO_file_seekoff_mmap (fp, offset, dir, mode)
@ -1220,7 +1217,7 @@ _IO_file_read (fp, buf, size)
? read_not_cancel (fp->_fileno, buf, size)
: read (fp->_fileno, buf, size));
}
INTDEF(_IO_file_read)
libc_hidden_def (_IO_file_read)
_IO_off64_t
_IO_file_seek (fp, offset, dir)
@ -1234,7 +1231,7 @@ _IO_file_seek (fp, offset, dir)
return lseek (fp->_fileno, offset, dir);
#endif
}
INTDEF(_IO_file_seek)
libc_hidden_def (_IO_file_seek)
int
_IO_file_stat (fp, st)
@ -1247,7 +1244,7 @@ _IO_file_stat (fp, st)
return fstat (fp->_fileno, (struct stat *) st);
#endif
}
INTDEF(_IO_file_stat)
libc_hidden_def (_IO_file_stat)
int
_IO_file_close_mmap (fp)
@ -1269,7 +1266,7 @@ _IO_file_close (fp)
unrecoverable state behind. */
return close_not_cancel (fp->_fileno);
}
INTDEF(_IO_file_close)
libc_hidden_def (_IO_file_close)
_IO_ssize_t
_IO_new_file_write (f, data, n)
@ -1376,11 +1373,11 @@ _IO_new_file_xsputn (f, data, n)
buffer, but it's somewhat messier for line-buffered files,
so we let _IO_default_xsputn handle the general case. */
if (to_do)
to_do -= INTUSE(_IO_default_xsputn) (f, s+do_write, to_do);
to_do -= _IO_default_xsputn (f, s+do_write, to_do);
}
return n - to_do;
}
INTDEF2(_IO_new_file_xsputn, _IO_file_xsputn)
libc_hidden_ver (_IO_new_file_xsputn, _IO_file_xsputn)
_IO_size_t
_IO_file_xsgetn (fp, data, n)
@ -1402,7 +1399,7 @@ _IO_file_xsgetn (fp, data, n)
free (fp->_IO_save_base);
fp->_flags &= ~_IO_IN_BACKUP;
}
INTUSE(_IO_doallocbuf) (fp);
_IO_doallocbuf (fp);
}
while (want > 0)
@ -1481,7 +1478,7 @@ _IO_file_xsgetn (fp, data, n)
return n - want;
}
INTDEF(_IO_file_xsgetn)
libc_hidden_def (_IO_file_xsgetn)
static _IO_size_t _IO_file_xsgetn_mmap (_IO_FILE *, void *, _IO_size_t);
static _IO_size_t
@ -1557,8 +1554,6 @@ _IO_file_xsgetn_maybe_mmap (fp, data, n)
}
#ifdef _LIBC
# undef _IO_do_write
# undef _IO_file_close_it
versioned_symbol (libc, _IO_new_do_write, _IO_do_write, GLIBC_2_1);
versioned_symbol (libc, _IO_new_file_attach, _IO_file_attach, GLIBC_2_1);
versioned_symbol (libc, _IO_new_file_close_it, _IO_file_close_it, GLIBC_2_1);
@ -1577,23 +1572,23 @@ versioned_symbol (libc, _IO_new_file_xsputn, _IO_file_xsputn, GLIBC_2_1);
const struct _IO_jump_t _IO_file_jumps =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, INTUSE(_IO_file_finish)),
JUMP_INIT(overflow, INTUSE(_IO_file_overflow)),
JUMP_INIT(underflow, INTUSE(_IO_file_underflow)),
JUMP_INIT(uflow, INTUSE(_IO_default_uflow)),
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(xsputn, INTUSE(_IO_file_xsputn)),
JUMP_INIT(xsgetn, INTUSE(_IO_file_xsgetn)),
JUMP_INIT(finish, _IO_file_finish),
JUMP_INIT(overflow, _IO_file_overflow),
JUMP_INIT(underflow, _IO_file_underflow),
JUMP_INIT(uflow, _IO_default_uflow),
JUMP_INIT(pbackfail, _IO_default_pbackfail),
JUMP_INIT(xsputn, _IO_file_xsputn),
JUMP_INIT(xsgetn, _IO_file_xsgetn),
JUMP_INIT(seekoff, _IO_new_file_seekoff),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, _IO_new_file_setbuf),
JUMP_INIT(sync, _IO_new_file_sync),
JUMP_INIT(doallocate, INTUSE(_IO_file_doallocate)),
JUMP_INIT(read, INTUSE(_IO_file_read)),
JUMP_INIT(doallocate, _IO_file_doallocate),
JUMP_INIT(read, _IO_file_read),
JUMP_INIT(write, _IO_new_file_write),
JUMP_INIT(seek, INTUSE(_IO_file_seek)),
JUMP_INIT(close, INTUSE(_IO_file_close)),
JUMP_INIT(stat, INTUSE(_IO_file_stat)),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close),
JUMP_INIT(stat, _IO_file_stat),
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue)
};
@ -1602,23 +1597,23 @@ libc_hidden_data_def (_IO_file_jumps)
const struct _IO_jump_t _IO_file_jumps_mmap =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, INTUSE(_IO_file_finish)),
JUMP_INIT(overflow, INTUSE(_IO_file_overflow)),
JUMP_INIT(finish, _IO_file_finish),
JUMP_INIT(overflow, _IO_file_overflow),
JUMP_INIT(underflow, _IO_file_underflow_mmap),
JUMP_INIT(uflow, INTUSE(_IO_default_uflow)),
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(uflow, _IO_default_uflow),
JUMP_INIT(pbackfail, _IO_default_pbackfail),
JUMP_INIT(xsputn, _IO_new_file_xsputn),
JUMP_INIT(xsgetn, _IO_file_xsgetn_mmap),
JUMP_INIT(seekoff, _IO_file_seekoff_mmap),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
JUMP_INIT(sync, _IO_file_sync_mmap),
JUMP_INIT(doallocate, INTUSE(_IO_file_doallocate)),
JUMP_INIT(read, INTUSE(_IO_file_read)),
JUMP_INIT(doallocate, _IO_file_doallocate),
JUMP_INIT(read, _IO_file_read),
JUMP_INIT(write, _IO_new_file_write),
JUMP_INIT(seek, INTUSE(_IO_file_seek)),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close_mmap),
JUMP_INIT(stat, INTUSE(_IO_file_stat)),
JUMP_INIT(stat, _IO_file_stat),
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue)
};
@ -1626,23 +1621,23 @@ const struct _IO_jump_t _IO_file_jumps_mmap =
const struct _IO_jump_t _IO_file_jumps_maybe_mmap =
{
JUMP_INIT_DUMMY,
JUMP_INIT(finish, INTUSE(_IO_file_finish)),
JUMP_INIT(overflow, INTUSE(_IO_file_overflow)),
JUMP_INIT(finish, _IO_file_finish),
JUMP_INIT(overflow, _IO_file_overflow),
JUMP_INIT(underflow, _IO_file_underflow_maybe_mmap),
JUMP_INIT(uflow, INTUSE(_IO_default_uflow)),
JUMP_INIT(pbackfail, INTUSE(_IO_default_pbackfail)),
JUMP_INIT(uflow, _IO_default_uflow),
JUMP_INIT(pbackfail, _IO_default_pbackfail),
JUMP_INIT(xsputn, _IO_new_file_xsputn),
JUMP_INIT(xsgetn, _IO_file_xsgetn_maybe_mmap),
JUMP_INIT(seekoff, _IO_file_seekoff_maybe_mmap),
JUMP_INIT(seekpos, _IO_default_seekpos),
JUMP_INIT(setbuf, (_IO_setbuf_t) _IO_file_setbuf_mmap),
JUMP_INIT(sync, _IO_new_file_sync),
JUMP_INIT(doallocate, INTUSE(_IO_file_doallocate)),
JUMP_INIT(read, INTUSE(_IO_file_read)),
JUMP_INIT(doallocate, _IO_file_doallocate),
JUMP_INIT(read, _IO_file_read),
JUMP_INIT(write, _IO_new_file_write),
JUMP_INIT(seek, INTUSE(_IO_file_seek)),
JUMP_INIT(seek, _IO_file_seek),
JUMP_INIT(close, _IO_file_close),
JUMP_INIT(stat, INTUSE(_IO_file_stat)),
JUMP_INIT(stat, _IO_file_stat),
JUMP_INIT(showmanyc, _IO_default_showmanyc),
JUMP_INIT(imbue, _IO_default_imbue)
};