Commit Graph

13 Commits

Author SHA1 Message Date
Corinna Vinschen 2607f00423 Revert "newlib: fix fseek optimization with SEEK_CUR"
This reverts commit 59362c80e3.

This breaks gnulib's autoconf test for POSIX compatibility of
fflush/fseek.  After fflush/fseek, ftello and lseek are out of
sync, with lseek having the wrong offset.  This breaks backward
compatibility with Cygwin applications.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2020-01-29 18:53:44 +01:00
Bastien Bouclet 59362c80e3 newlib: fix fseek optimization with SEEK_CUR
The call to fflush was invalidating the read buffer, preventing relative
seeks to positions that would have been inside the read buffer from
being optimized. The call to srefill would then re-read mostly the same
data that was initially in the read buffer.
2019-11-18 11:02:52 +01:00
Yaakov Selkowitz 77f16db546 ansification: remove _EXFNPTR, _EXPARM
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:27 -06:00
Yaakov Selkowitz 9087163804 ansification: remove _DEFUN
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:26 -06:00
Yaakov Selkowitz e6321aa6a6 ansification: remove _PTR
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:16 -06:00
Yaakov Selkowitz 6783860a2e ansification: remove _AND
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2018-01-17 11:47:05 -06:00
Yaakov Selkowitz c7ef9668cf stdio: remove TRAD_SYNOPSIS
Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
2017-12-01 03:41:51 -06:00
Jeff Johnston 602cec7f1e 2013-04-10 Bin Cheng <bin.cheng@arm.com>
* acconfig.h (_FSEEK_OPTIMIZATION): Undef
        * newlib.hin (_FSEEK_OPTIMIZATION): Undef
        * configure.in (--disable-newlib-fseek-optimization): New option.
        * configure: Regenerated.
        * libc/stdio/fflush.c (__sflush_r): Use _FSEEK_OPTIMIZATION to
        control fseek optimization.
        * libc/stdio/fseeko.c (_fseeko_r): Ditto.
        * libc/stdio/makebuf.c (__smakebuf_r): Ditto.
        * libc/stdio64/fseeko64.c (_fseeko64_r): Ditto.
2013-04-10 18:47:46 +00:00
Corinna Vinschen 0772f3f1c1 * libc/include/sys/reent.h (__sFILE): Change type of _offset
from int to _off_t.
	* libc/stdio/ftell.c: Use _ftello_r().
	* libc/stdio/ftello.c: Copy implementation from previous
	_ftell_r().
	* libc/stdio/fseek.c: Use _fseeko_r().
	* libc/stdio/fseeko.c: Copy implementation from previous
	_fseek_r().
2012-11-29 16:28:30 +00:00
Jeff Johnston 05b315770a 2004-04-23 Artem B. Bityuckiy <abitytsky@softminecorp.com>
* libc/stdio/asprintf.c libc/stdio/clearerr.c,
        libc/stdio/fclose.c libc/stdio/fcloseall.c libc/stdio/fdopen.c,
        libc/stdio/feof.c libc/stdio/ferror.c libc/stdio/fflush.c,
        libc/stdio/fgetc.c libc/stdio/fgetpos.c libc/stdio/fgets.c,
        libc/stdio/fileno.c libc/stdio/findfp.c libc/stdio/fiprintf.c,
        libc/stdio/flags.c libc/stdio/fopen.c libc/stdio/fprintf.c,
        libc/stdio/fputc.c libc/stdio/fputs.c libc/stdio/fread.c,
        libc/stdio/freopen.c libc/stdio/fscanf.c libc/stdio/fseek.c,
        libc/stdio/fseeko.c libc/stdio/fsetpos.c libc/stdio/ftell.c,
        libc/stdio/ftello.c libc/stdio/fvwrite.c libc/stdio/fwalk.c,
        libc/stdio/fwrite.c libc/stdio/getc.c libc/stdio/getc_u.c,
        libc/stdio/getchar.c libc/stdio/getchar_u.c,
        libc/stdio/getdelim.c libc/stdio/getline.c libc/stdio/gets.c,
        libc/stdio/getw.c libc/stdio/iprintf.c libc/stdio/local.h,
        libc/stdio/makebuf.c libc/stdio/mktemp.c libc/stdio/perror.c,
        libc/stdio/printf.c libc/stdio/putc.c libc/stdio/putc_u.c,
        libc/stdio/putchar.c libc/stdio/putchar_u.c libc/stdio/puts.c,
        libc/stdio/putw.c libc/stdio/refill.c libc/stdio/remove.c,
        libc/stdio/rename.c libc/stdio/rewind.c libc/stdio/rget.c,
        libc/stdio/scanf.c libc/stdio/setbuf.c libc/stdio/setbuffer.c,
        libc/stdio/setlinebuf.c libc/stdio/setvbuf.c,
        libc/stdio/siprintf.c libc/stdio/snprintf.c,
        libc/stdio/sprintf.c libc/stdio/sscanf.c libc/stdio/stdio.c,
        libc/stdio/tmpfile.c libc/stdio/tmpnam.c libc/stdio/ungetc.c,
        libc/stdio/vasprintf.c libc/stdio/vfieeefp.h,
        libc/stdio/vfprintf.c libc/stdio/vfscanf.c,
        libc/stdio/vprintf.c libc/stdio/vscanf.c,
        libc/stdio/vsnprintf.c libc/stdio/vsprintf.c,
        libc/stdio/vsscanf.c libc/stdio/wbuf.c,
        libc/stdio/wsetup.c: Perform minor formatting changes.  Move
        copyright notices to top of file, ensure that <_ansi.h> is
        included, be consistent with open parentheses, use _DEFUN macro,
        include "local.h" where needed, and remove various compiler
        warnings.
2004-04-23 20:01:55 +00:00
Jeff Johnston 9fc9e1c916 2003-08-22 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/sys/reent.h: Add _GLOBAL_REENT macro.
	* libc/stdio: Globally remove/replace all references to fp->_data.
	Replace with _REENT or _GLOBAL_REENT where appropriate.
	* libc/stdio/asprintf.c: Ditto.
	* libc/stdio/fclose.c: Ditto.
	* libc/stdio/fvwrite.c: Ditto.
	* libc/stdio/makebuf.c: Ditto.
	* libc/stdio/refill.c: Ditto.
	* libc/stdio/local.h: Ditto.
	* libc/stdio/setvbuf.c: Ditto.
	* libc/stdio/sscanf.c: Ditto.
	* libc/stdio/stdio.c: Ditto.
	* libc/stdio/ungetc.c: Ditto.
	* libc/stdio/vfscanf.c: Ditto.
	* libc/stdio/vsscanf.c: Ditto.
	* libc/stdio/fopen.c: Ditto.  Also use _fseek_r in _fopen_r.
	* libc/stdio/vasprintf.c: Ditto.  Also call _vfprintf_r directly.
	* libc/stdio/vsnprintf.c: Ditto.
	* libc/stdio/vsprintf.c: Ditto.
	* libc/stdio/fcloseall.c(fcloseall): Use _GLOBAL_REENT macro
	instead of _REENT to walk file list.
	* libc/stdio/fflush.c: Ditto.
	* libc/stdio/fgetpos.c: Add reentrant version and have regular
	version call reentrant version with _REENT argument.
	* libc/stdio/fsetpos.c: Ditto.
	* libc/stdio/fseek.c: Ditto.
	* libc/stdio/fseeko.c: Ditto.
	* libc/stdio/ftell.c: Ditto.
	* libc/stdio/ftello.c: Ditto.
	* libc/stdio/freopen.c: Ditto.
	* libc/stdio/findfp.c: Use _GLOBAL_REENT pointer when adding
	new files to chain.  Also use _GLOBAL_REENT pointer for
	cleaning up.
	* libc/stdio/fiprintf.c: Reformatted to minimize duplicate code.
	* libc/stdio/siprintf.c: Ditto.
	* libc/stdio/iprintf.c: Ditto.
	* libc/stdio/fprintf.c: Ditto.
	* libc/stdio/printf.c: Ditto.
	* libc/stdio/snprintf.c: Call _vfprintf_r directly.
	* libc/stdio/sprintf.c: Ditto.
	* libc/stdio/vprintf.c: Ditto.  Also add _REENT_ONLY check.
	* libc/stdio/rewind.c: Call _fseek_r directly.
	* libc/stdio/tmpfile.c: Call _fopen_r and _remove_r directly.
	* libc/stdio/vfprintf.c (_VFPRINTF_R): Change _r routines to use
	data pointer.
	(get_arg): Add extra struct _reent pointer argument.
	* libc/stdio64/fgetpos64.c: Add _r versions, remove any reference
	to fp->_data.
	* libc/stdio64/fopen64.c: Ditto.
	* libc/stdio64/freopen64.c: Ditto.
	* libc/stdio64/fsetpos64.c: Ditto.
	* libc/stdio64/ftello64.c: Ditto.
	* libc/stdio64/local64.h: Ditto.
	* libc/stdio64/stdio64.c: Ditto.
	* libc/stdio64/fseeko64.c: Ditto plus use _fstat_r instead of
	_fstat64_r for the meantime.
2003-08-22 18:52:25 +00:00
Corinna Vinschen 2a940c1a22 * libc/include/stdio.h: Declare fgetpos, fsetpos, fseeko and ftello
with internal (_fpos_t and _off_t) datatypes when compiling newlib.
	* libc/include/sys/unistd.h: Declare _lseek using _off_t.
	* libc/reent/lseekr.c (_lseek_r): Use _off_t instead of off_t.
	* libc/stdio/fseeko.c (fseeko): Ditto.
	* libc/stdio/ftello.c (ftello): Ditto.
	* libc/stdio/stdio.c (__swrite): Ditto.
	(__sseek): Ditto.
	* libc/stdio/fgetpos.c (fgetpos): Use _fpos_t instead of fpos_t.
	* libc/stdio/fseek.c (fseek): Ditto.
	* libc/stdio/fsetpos.c (fsetpos): Ditto.
	* libc/stdio/ftell.c (ftell): Ditto.
	* libc/stdio/local.h: Declare __sseek using _off_t.
2003-03-14 18:39:05 +00:00
Jeff Johnston 30b2092fcb 2002-07-04 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/stdio.h: Add new prototypes.
        * libc/stdio/Makefile.am: Add fseeko.c and ftello.c.
        * libc/stdio/Makefile.in: Regenerated.
        * libc/stdio/fseek.c: Add fseeko documentation.
        * libc/stdio/ftell.c: Add ftello documentation.
        * libc/stdio/fseeko.c: New file.
        * libc/stdio/ftello.c: New file.
2002-07-04 19:33:54 +00:00