Remove miscellaneous debris from libio.

This patch eliminates a number of #if 0 and #ifdef TODO blocks, macros
that are never used, macros that provide portability to substrates that
lack basic things like EINVAL and off_t, and other such debris.

I preserved IO_DEBUG and CHECK_FILE, even though as far as I can tell
IO_DEBUG is never defined and therefore CHECK_FILE never does
anything, because it seems like we might actually want to turn it _on_.

Installed stripped libraries and executables are unchanged, except,
again, that the line number of an assertion changes (this time it's
somewhere in fileops.c).

	* libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust):
	Define here, unconditionally.
	* libio/iolibio.h (_IO_pos_BAD): Don't define here.
	* libio/libioP.h: Remove #if 0 blocks.
	(_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here.
	(_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define.
	(CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE.  Fix style.

	* libio/clearerr.c, libio/fputc.c, libio/getchar.c:
	Assume weak_alias is always defined.

	* libio/fileops.c, libio/genops.c, libio/oldfileops.c
	* libio/oldpclose.c, libio/pclose.c, libio/wfileops.c:
	Remove #if 0 and #ifdef TODO blocks.
	Assume text_set_element is always defined.

	* libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c
	Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL.
	* libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.
This commit is contained in:
Zack Weinberg 2018-02-21 14:38:24 -05:00
parent df6c012b99
commit 30bfee2630
20 changed files with 54 additions and 236 deletions

View File

@ -1,5 +1,25 @@
2018-02-21 Zack Weinberg <zackw@panix.com> 2018-02-21 Zack Weinberg <zackw@panix.com>
* libio/libio.h (_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust):
Define here, unconditionally.
* libio/iolibio.h (_IO_pos_BAD): Don't define here.
* libio/libioP.h: Remove #if 0 blocks.
(_IO_pos_BAD, _IO_pos_0, _IO_pos_adjust): Don't define here.
(_IO_va_start, COERCE_FILE, MAYBE_SET_EINVAL): Don't define.
(CHECK_FILE): Don't use MAYBE_SET_EINVAL or COERCE_FILE. Fix style.
* libio/clearerr.c, libio/fputc.c, libio/getchar.c:
Assume weak_alias is always defined.
* libio/fileops.c, libio/genops.c, libio/oldfileops.c
* libio/oldpclose.c, libio/pclose.c, libio/wfileops.c:
Remove #if 0 and #ifdef TODO blocks.
Assume text_set_element is always defined.
* libio/iofdopen.c, libio/iogetdelim.c, libio/oldiofdopen.c
Use __set_errno (EINVAL) instead of MAYBE_SET_EINVAL.
* libio/tst-mmap-eofsync.c: Make #if 1 block unconditional.
* libio/libio.h (_IOS_ATEND, _IOS_APPEND, _IOS_TRUNC) * libio/libio.h (_IOS_ATEND, _IOS_APPEND, _IOS_TRUNC)
(_IOS_NOCREATE, _IOS_NOREPLACE, _IOS_BIN, _OLD_STDIO_MAGIC) (_IOS_NOCREATE, _IOS_NOREPLACE, _IOS_BIN, _OLD_STDIO_MAGIC)
(_IO_SKIPWS, _IO_LEFT, _IO_RIGHT, _IO_INTERNAL, _IO_DEC) (_IO_SKIPWS, _IO_LEFT, _IO_RIGHT, _IO_INTERNAL, _IO_DEC)

View File

@ -27,6 +27,6 @@ clearerr (FILE *fp)
_IO_funlockfile (fp); _IO_funlockfile (fp);
} }
#if defined weak_alias && !defined _IO_MTSAFE_IO #ifndef _IO_MTSAFE_IO
weak_alias (clearerr, clearerr_unlocked) weak_alias (clearerr, clearerr_unlocked)
#endif #endif

View File

@ -494,13 +494,9 @@ _IO_new_file_underflow (FILE *fp)
_IO_doallocbuf (fp); _IO_doallocbuf (fp);
} }
/* Flush all line buffered files before reading. */
/* FIXME This can/should be moved to genops ?? */ /* FIXME This can/should be moved to genops ?? */
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED)) if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
{ {
#if 0
_IO_flush_all_linebuffered ();
#else
/* We used to flush all line-buffered stream. This really isn't /* We used to flush all line-buffered stream. This really isn't
required by any standard. My recollection is that required by any standard. My recollection is that
traditional Unix systems did this for stdout. stderr better traditional Unix systems did this for stdout. stderr better
@ -513,7 +509,6 @@ _IO_new_file_underflow (FILE *fp)
_IO_OVERFLOW (_IO_stdout, EOF); _IO_OVERFLOW (_IO_stdout, EOF);
_IO_release_lock (_IO_stdout); _IO_release_lock (_IO_stdout);
#endif
} }
_IO_switch_to_get_mode (fp); _IO_switch_to_get_mode (fp);
@ -813,10 +808,6 @@ _IO_new_file_sync (FILE *fp)
delta = fp->_IO_read_ptr - fp->_IO_read_end; delta = fp->_IO_read_ptr - fp->_IO_read_end;
if (delta != 0) if (delta != 0)
{ {
#ifdef TODO
if (_IO_in_backup (fp))
delta -= eGptr () - Gbase ();
#endif
off64_t new_pos = _IO_SYSSEEK (fp, delta, 1); off64_t new_pos = _IO_SYSSEEK (fp, delta, 1);
if (new_pos != (off64_t) EOF) if (new_pos != (off64_t) EOF)
fp->_IO_read_end = fp->_IO_read_ptr; fp->_IO_read_end = fp->_IO_read_ptr;
@ -838,10 +829,6 @@ _IO_file_sync_mmap (FILE *fp)
{ {
if (fp->_IO_read_ptr != fp->_IO_read_end) if (fp->_IO_read_ptr != fp->_IO_read_end)
{ {
#ifdef TODO
if (_IO_in_backup (fp))
delta -= eGptr () - Gbase ();
#endif
if (__lseek64 (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base, if (__lseek64 (fp->_fileno, fp->_IO_read_ptr - fp->_IO_buf_base,
SEEK_SET) SEEK_SET)
!= fp->_IO_read_ptr - fp->_IO_buf_base) != fp->_IO_read_ptr - fp->_IO_buf_base)

View File

@ -40,7 +40,7 @@ fputc (int c, FILE *fp)
return result; return result;
} }
#if defined weak_alias && !defined _IO_MTSAFE_IO #ifndef _IO_MTSAFE_IO
#undef fputc_unlocked #undef fputc_unlocked
weak_alias (fputc, fputc_unlocked) weak_alias (fputc, fputc_unlocked)
#endif #endif

View File

@ -194,24 +194,6 @@ _IO_free_backup_area (FILE *fp)
} }
libc_hidden_def (_IO_free_backup_area) libc_hidden_def (_IO_free_backup_area)
#if 0
int
_IO_switch_to_put_mode (FILE *fp)
{
fp->_IO_write_base = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_read_ptr;
/* Following is wrong if line- or un-buffered? */
fp->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
? fp->_IO_read_end : fp->_IO_buf_end);
fp->_IO_read_ptr = fp->_IO_read_end;
fp->_IO_read_base = fp->_IO_read_end;
fp->_flags |= _IO_CURRENTLY_PUTTING;
return 0;
}
#endif
int int
__overflow (FILE *f, int ch) __overflow (FILE *f, int ch)
{ {
@ -465,15 +447,6 @@ _IO_default_xsgetn (FILE *fp, void *data, size_t n)
} }
libc_hidden_def (_IO_default_xsgetn) libc_hidden_def (_IO_default_xsgetn)
#if 0
/* Seems not to be needed. --drepper */
int
_IO_sync (FILE *fp)
{
return 0;
}
#endif
FILE * FILE *
_IO_default_setbuf (FILE *fp, char *p, ssize_t len) _IO_default_setbuf (FILE *fp, char *p, ssize_t len)
{ {
@ -697,28 +670,6 @@ _IO_sungetc (FILE *fp)
return result; return result;
} }
#if 0 /* Work in progress */
/* Seems not to be needed. */
#if 0
void
_IO_set_column (FILE *fp, int c)
{
if (c == -1)
fp->_column = -1;
else
fp->_column = c - (fp->_IO_write_ptr - fp->_IO_write_base);
}
#else
int
_IO_set_column (FILE *fp, int i)
{
fp->_cur_column = i + 1;
return 0;
}
#endif
#endif
unsigned unsigned
_IO_adjust_column (unsigned start, const char *line, int count) _IO_adjust_column (unsigned start, const char *line, int count)
{ {
@ -730,20 +681,6 @@ _IO_adjust_column (unsigned start, const char *line, int count)
} }
libc_hidden_def (_IO_adjust_column) libc_hidden_def (_IO_adjust_column)
#if 0
/* Seems not to be needed. --drepper */
int
_IO_get_column (FILE *fp)
{
if (fp->_cur_column)
return _IO_adjust_column (fp->_cur_column - 1,
fp->_IO_write_base,
fp->_IO_write_ptr - fp->_IO_write_base);
return -1;
}
#endif
int int
_IO_flush_all_lockp (int do_lock) _IO_flush_all_lockp (int do_lock)
{ {
@ -964,10 +901,8 @@ _IO_remove_marker (struct _IO_marker *marker)
return; return;
} }
} }
#if 0 /* FIXME: if _sbuf has a backup area that is no longer needed,
if _sbuf has a backup area that is no longer needed, should we delete should we delete it now, or wait until the next underflow? */
it now, or wait until the next underflow?
#endif
} }
#define BAD_DELTA EOF #define BAD_DELTA EOF
@ -1018,20 +953,6 @@ _IO_unsave_markers (FILE *fp)
struct _IO_marker *mark = fp->_markers; struct _IO_marker *mark = fp->_markers;
if (mark) if (mark)
{ {
#ifdef TODO
streampos offset = seekoff (0, ios::cur, ios::in);
if (offset != EOF)
{
offset += eGptr () - Gbase ();
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (mark->_pos + offset);
}
else
{
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (EOF);
}
#endif
fp->_markers = 0; fp->_markers = 0;
} }
@ -1040,19 +961,6 @@ _IO_unsave_markers (FILE *fp)
} }
libc_hidden_def (_IO_unsave_markers) libc_hidden_def (_IO_unsave_markers)
#if 0
/* Seems not to be needed. --drepper */
int
_IO_nobackup_pbackfail (FILE *fp, int c)
{
if (fp->_IO_read_ptr > fp->_IO_read_base)
fp->_IO_read_ptr--;
if (c != EOF && *fp->_IO_read_ptr != c)
*fp->_IO_read_ptr = c;
return (unsigned char) c;
}
#endif
int int
_IO_default_pbackfail (FILE *fp, int c) _IO_default_pbackfail (FILE *fp, int c)
{ {
@ -1200,24 +1108,4 @@ _IO_list_resetlock (void)
} }
libc_hidden_def (_IO_list_resetlock) libc_hidden_def (_IO_list_resetlock)
#ifdef TODO
#if defined(linux)
#define IO_CLEANUP ;
#endif
#ifdef IO_CLEANUP
IO_CLEANUP
#else
struct __io_defs {
__io_defs() { }
~__io_defs() { _IO_cleanup (); }
};
__io_defs io_defs__;
#endif
#endif /* TODO */
#ifdef text_set_element
text_set_element(__libc_atexit, _IO_cleanup); text_set_element(__libc_atexit, _IO_cleanup);
#endif

View File

@ -41,7 +41,7 @@ getchar (void)
return result; return result;
} }
#if defined weak_alias && !defined _IO_MTSAFE_IO #ifndef _IO_MTSAFE_IO
#undef getchar_unlocked #undef getchar_unlocked
weak_alias (getchar, getchar_unlocked) weak_alias (getchar, getchar_unlocked)
#endif #endif

View File

@ -62,7 +62,7 @@ _IO_new_fdopen (int fd, const char *mode)
read_write = _IO_NO_READS|_IO_IS_APPENDING; read_write = _IO_NO_READS|_IO_IS_APPENDING;
break; break;
default: default:
MAYBE_SET_EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
for (i = 1; i < 5; ++i) for (i = 1; i < 5; ++i)
@ -92,7 +92,7 @@ _IO_new_fdopen (int fd, const char *mode)
if (((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES)) if (((fd_flags & O_ACCMODE) == O_RDONLY && !(read_write & _IO_NO_WRITES))
|| ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS))) || ((fd_flags & O_ACCMODE) == O_WRONLY && !(read_write & _IO_NO_READS)))
{ {
MAYBE_SET_EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }

View File

@ -45,7 +45,7 @@ _IO_getdelim (char **lineptr, size_t *n, int delimiter, FILE *fp)
if (lineptr == NULL || n == NULL) if (lineptr == NULL || n == NULL)
{ {
MAYBE_SET_EINVAL; __set_errno (EINVAL);
return -1; return -1;
} }
CHECK_FILE (fp, -1); CHECK_FILE (fp, -1);

View File

@ -59,9 +59,6 @@ struct obstack;
extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list) extern int _IO_obstack_vprintf (struct obstack *, const char *, __gnuc_va_list)
__THROW; __THROW;
extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW; extern int _IO_obstack_printf (struct obstack *, const char *, ...) __THROW;
#ifndef _IO_pos_BAD
#define _IO_pos_BAD ((off64_t)(-1))
#endif
#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN)) #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
#define _IO_fseek(__fp, __offset, __whence) \ #define _IO_fseek(__fp, __offset, __whence) \
(_IO_seekoff_unlocked (__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \ (_IO_seekoff_unlocked (__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \

View File

@ -97,6 +97,14 @@ typedef union
#define _IO_FLAGS2_CLOEXEC 64 #define _IO_FLAGS2_CLOEXEC 64
#define _IO_FLAGS2_NEED_LOCK 128 #define _IO_FLAGS2_NEED_LOCK 128
/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
#define _IO_pos_BAD ((off64_t) -1)
/* _IO_pos_adjust adjusts an off64_t by some number of bytes. */
#define _IO_pos_adjust(pos, delta) ((pos) += (delta))
/* _IO_pos_0 is an off64_t value indicating beginning of file. */
#define _IO_pos_0 ((off64_t) 0)
struct _IO_jump_t; struct _IO_jump_t;

View File

@ -309,10 +309,6 @@ struct _IO_jump_t
JUMP_FIELD(_IO_stat_t, __stat); JUMP_FIELD(_IO_stat_t, __stat);
JUMP_FIELD(_IO_showmanyc_t, __showmanyc); JUMP_FIELD(_IO_showmanyc_t, __showmanyc);
JUMP_FIELD(_IO_imbue_t, __imbue); JUMP_FIELD(_IO_imbue_t, __imbue);
#if 0
get_column;
set_column;
#endif
}; };
/* We always allocate an extra word following an _IO_FILE. /* We always allocate an extra word following an _IO_FILE.
@ -710,19 +706,6 @@ extern off64_t _IO_seekpos_unlocked (FILE *, off64_t, int)
extern int _IO_vscanf (const char *, va_list) __THROW; extern int _IO_vscanf (const char *, va_list) __THROW;
/* _IO_pos_BAD is an off64_t value indicating error, unknown, or EOF. */
#ifndef _IO_pos_BAD
# define _IO_pos_BAD ((off64_t) -1)
#endif
/* _IO_pos_adjust adjust an off64_t by some number of bytes. */
#ifndef _IO_pos_adjust
# define _IO_pos_adjust(pos, delta) ((pos) += (delta))
#endif
/* _IO_pos_0 is an off64_t value indicating beginning of file. */
#ifndef _IO_pos_0
# define _IO_pos_0 ((off64_t) 0)
#endif
#ifdef _IO_MTSAFE_IO #ifdef _IO_MTSAFE_IO
/* check following! */ /* check following! */
# ifdef _IO_USE_OLD_IO_FILE # ifdef _IO_USE_OLD_IO_FILE
@ -752,33 +735,19 @@ extern int _IO_vscanf (const char *, va_list) __THROW;
# endif # endif
#endif #endif
#define _IO_va_start(args, last) va_start(args, last)
extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf; extern struct _IO_fake_stdiobuf _IO_stdin_buf, _IO_stdout_buf, _IO_stderr_buf;
#if 1
# define COERCE_FILE(FILE) /* Nothing */
#else
/* This is part of the kludge for binary compatibility with old stdio. */
# define COERCE_FILE(FILE) \
(((FILE)->_flags & _IO_MAGIC_MASK) == _OLD_MAGIC_MASK \
&& (FILE) = *(FILE**)&((int*)fp)[1])
#endif
#ifdef EINVAL
# define MAYBE_SET_EINVAL __set_errno (EINVAL)
#else
# define MAYBE_SET_EINVAL /* nothing */
#endif
#ifdef IO_DEBUG #ifdef IO_DEBUG
# define CHECK_FILE(FILE, RET) \ # define CHECK_FILE(FILE, RET) do { \
if ((FILE) == NULL) { MAYBE_SET_EINVAL; return RET; } \ if ((FILE) == NULL || \
else { COERCE_FILE(FILE); \ ((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \
if (((FILE)->_flags & _IO_MAGIC_MASK) != _IO_MAGIC) \ { \
{ MAYBE_SET_EINVAL; return RET; }} __set_errno (EINVAL); \
return RET; \
} \
} while (0)
#else #else
# define CHECK_FILE(FILE, RET) COERCE_FILE (FILE) # define CHECK_FILE(FILE, RET) do { } while (0)
#endif #endif
static inline void static inline void

View File

@ -516,10 +516,6 @@ _IO_old_file_seekoff (FILE *fp, off64_t offset, int dir, int mode)
+ (fp->_IO_read_end - fp->_IO_read_base)); + (fp->_IO_read_end - fp->_IO_read_base));
if (rel_offset >= 0) if (rel_offset >= 0)
{ {
#if 0
if (_IO_in_backup (fp))
_IO_switch_to_main_get_area (fp);
#endif
if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base) if (rel_offset <= fp->_IO_read_end - fp->_IO_read_base)
{ {
_IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset, _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,

View File

@ -60,7 +60,7 @@ _IO_old_fdopen (int fd, const char *mode)
read_write = _IO_NO_READS|_IO_IS_APPENDING; read_write = _IO_NO_READS|_IO_IS_APPENDING;
break; break;
default: default:
MAYBE_SET_EINVAL; __set_errno (EINVAL);
return NULL; return NULL;
} }
if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+')) if (mode[0] == '+' || (mode[0] == 'b' && mode[1] == '+'))

View File

@ -32,16 +32,13 @@
#include "stdio.h" #include "stdio.h"
#include <errno.h> #include <errno.h>
/* POSIX does not require us to check that a stream passed to pclose()
was created by popen(). Instead we rely on _IO_SYSCLOSE to call
_proc_close when appropriate. */
int int
attribute_compat_text_section attribute_compat_text_section
__old_pclose (FILE *fp) __old_pclose (FILE *fp)
{ {
#if 0
/* Does not actually test that stream was created by popen(). Instead,
it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
if (fp is not a proc_file)
return -1;
#endif
return _IO_old_fclose (fp); return _IO_old_fclose (fp);
} }

View File

@ -29,15 +29,12 @@
#include <errno.h> #include <errno.h>
#include <shlib-compat.h> #include <shlib-compat.h>
/* POSIX does not require us to check that a stream passed to pclose()
was created by popen(). Instead we rely on _IO_SYSCLOSE to call
_proc_close when appropriate. */
int int
__new_pclose (FILE *fp) __new_pclose (FILE *fp)
{ {
#if 0
/* Does not actually test that stream was created by popen(). Instead,
it depends on the filebuf::sys_close() virtual to Do The Right Thing. */
if (fp is not a proc_file)
return -1;
#endif
return _IO_new_fclose (fp); return _IO_new_fclose (fp);
} }

View File

@ -60,7 +60,6 @@ do_test (void)
printf ("feof = %d, ferror = %d immediately after fgets\n", printf ("feof = %d, ferror = %d immediately after fgets\n",
feof (f), ferror (f)); feof (f), ferror (f));
#if 1
c = fgetc (f); c = fgetc (f);
if (c == EOF) if (c == EOF)
printf ("fgetc -> EOF (feof = %d, ferror = %d)\n", printf ("fgetc -> EOF (feof = %d, ferror = %d)\n",
@ -71,7 +70,6 @@ do_test (void)
c, feof (f), ferror (f)); c, feof (f), ferror (f));
result = 1; result = 1;
} }
#endif
c = write (temp_fd, text2, sizeof text2 - 1); c = write (temp_fd, text2, sizeof text2 - 1);
if (c == sizeof text2 - 1) if (c == sizeof text2 - 1)

View File

@ -196,13 +196,9 @@ _IO_wfile_underflow (FILE *fp)
_IO_wdoallocbuf (fp); _IO_wdoallocbuf (fp);
} }
/* Flush all line buffered files before reading. */
/* FIXME This can/should be moved to genops ?? */ /* FIXME This can/should be moved to genops ?? */
if (fp->_flags & (_IO_LINE_BUF | _IO_UNBUFFERED)) if (fp->_flags & (_IO_LINE_BUF | _IO_UNBUFFERED))
{ {
#if 0
_IO_flush_all_linebuffered ();
#else
/* We used to flush all line-buffered stream. This really isn't /* We used to flush all line-buffered stream. This really isn't
required by any standard. My recollection is that required by any standard. My recollection is that
traditional Unix systems did this for stdout. stderr better traditional Unix systems did this for stdout. stderr better
@ -215,7 +211,6 @@ _IO_wfile_underflow (FILE *fp)
_IO_OVERFLOW (_IO_stdout, EOF); _IO_OVERFLOW (_IO_stdout, EOF);
_IO_release_lock (_IO_stdout); _IO_release_lock (_IO_stdout);
#endif
} }
_IO_switch_to_get_mode (fp); _IO_switch_to_get_mode (fp);

View File

@ -426,26 +426,6 @@ _IO_free_wbackup_area (FILE *fp)
} }
libc_hidden_def (_IO_free_wbackup_area) libc_hidden_def (_IO_free_wbackup_area)
#if 0
int
_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;
/* Following is wrong if line- or un-buffered? */
fp->_wide_data->_IO_write_end = (fp->_flags & _IO_IN_BACKUP
? fp->_wide_data->_IO_read_end
: fp->_wide_data->_IO_buf_end);
fp->_wide_data->_IO_read_ptr = fp->_wide_data->_IO_read_end;
fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_end;
fp->_flags |= _IO_CURRENTLY_PUTTING;
return 0;
}
#endif
static int static int
save_for_wbackup (FILE *fp, wchar_t *end_p) save_for_wbackup (FILE *fp, wchar_t *end_p)
{ {
@ -624,20 +604,6 @@ _IO_unsave_wmarkers (FILE *fp)
struct _IO_marker *mark = fp->_markers; struct _IO_marker *mark = fp->_markers;
if (mark) if (mark)
{ {
#ifdef TODO
streampos offset = seekoff (0, ios::cur, ios::in);
if (offset != EOF)
{
offset += eGptr () - Gbase ();
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (mark->_pos + offset);
}
else
{
for ( ; mark != NULL; mark = mark->_next)
mark->set_streampos (EOF);
}
#endif
fp->_markers = 0; fp->_markers = 0;
} }

View File

@ -58,7 +58,7 @@
} \ } \
if (Format == NULL) \ if (Format == NULL) \
{ \ { \
MAYBE_SET_EINVAL; \ __set_errno (EINVAL); \
return -1; \ return -1; \
} \ } \
} while (0) } while (0)

View File

@ -172,7 +172,7 @@
} \ } \
else if (format == NULL) \ else if (format == NULL) \
{ \ { \
MAYBE_SET_EINVAL; \ __set_errno (EINVAL); \
return EOF; \ return EOF; \
} \ } \
} while (0) } while (0)