aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-12-06 22:39:13 +0000
committerUlrich Drepper <drepper@redhat.com>2004-12-06 22:39:13 +0000
commitc03c66ddb5423255ae5e5309443eaeaf90eac441 (patch)
tree728ad5bc7091652fe9c0a85491d27235a629b464
parente9a37a8390f6eb6e7ee34a1de8791ad9c16e3cef (diff)
downloadglibc-c03c66ddb5423255ae5e5309443eaeaf90eac441.tar
glibc-c03c66ddb5423255ae5e5309443eaeaf90eac441.tar.gz
glibc-c03c66ddb5423255ae5e5309443eaeaf90eac441.tar.bz2
glibc-c03c66ddb5423255ae5e5309443eaeaf90eac441.zip
Update.
2004-12-06 Ulrich Drepper <drepper@redhat.com> * libio/fileops.c (_IO_new_file_seekoff): Fix optimization of in-buffer seek. Remove dead code. 2004-12-02 Jakub Jelinek <jakub@redhat.com> * libio/Makefile (tests): Add bug-ungetc4. * libio/bug-ungetc4.c: New test.
-rw-r--r--ChangeLog10
-rw-r--r--libio/Makefile2
-rw-r--r--libio/fileops.c50
3 files changed, 19 insertions, 43 deletions
diff --git a/ChangeLog b/ChangeLog
index 1708f2d68b..4edb15a021 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-12-06 Ulrich Drepper <drepper@redhat.com>
+
+ * libio/fileops.c (_IO_new_file_seekoff): Fix optimization of in-buffer
+ seek. Remove dead code.
+
+2004-12-02 Jakub Jelinek <jakub@redhat.com>
+
+ * libio/Makefile (tests): Add bug-ungetc4.
+ * libio/bug-ungetc4.c: New test.
+
2004-12-06 Roland McGrath <roland@redhat.com>
* sysdeps/unix/clock_nanosleep.c (clock_nanosleep): Diagnose EINVAL
diff --git a/libio/Makefile b/libio/Makefile
index 1d7611d252..a97623f14a 100644
--- a/libio/Makefile
+++ b/libio/Makefile
@@ -54,7 +54,7 @@ tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc \
tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
- bug-ungetc2 bug-ftell bug-ungetc3
+ bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4
test-srcs = test-freopen
all: # Make this the default target; it will be defined in Rules.
diff --git a/libio/fileops.c b/libio/fileops.c
index 2d787d296f..19151cf188 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -1035,54 +1035,20 @@ _IO_new_file_seekoff (fp, offset, dir, mode)
if (fp->_offset != _IO_pos_BAD && fp->_IO_read_base != NULL
&& !_IO_in_backup (fp))
{
- /* Offset relative to start of main get area. */
- _IO_off64_t rel_offset = (offset - fp->_offset
- + (fp->_IO_read_end - fp->_IO_read_base));
- if (rel_offset >= 0)
+ _IO_off64_t start_offset = (fp->_offset
+ - (fp->_IO_read_end - fp->_IO_buf_base));
+ if (offset >= start_offset && offset < fp->_offset)
{
-#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)
- {
- _IO_setg (fp, fp->_IO_buf_base, fp->_IO_buf_base + rel_offset,
- fp->_IO_read_end);
- _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
- {
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
- }
-#ifdef TODO
- /* If we have streammarkers, seek forward by reading ahead. */
- if (_IO_have_markers (fp))
- {
- int to_skip = rel_offset
- - (fp->_IO_read_ptr - fp->_IO_read_base);
- if (ignore (to_skip) != to_skip)
- goto dumb;
- _IO_mask_flags (fp, 0, _IO_EOF_SEEN);
- goto resync;
- }
-#endif
- }
-#ifdef TODO
- if (rel_offset < 0 && rel_offset >= Bbase () - Bptr ())
- {
- if (!_IO_in_backup (fp))
- _IO_switch_to_backup_area (fp);
- gbump (fp->_IO_read_end + rel_offset - fp->_IO_read_ptr);
+ _IO_setg (fp, fp->_IO_buf_base,
+ fp->_IO_buf_base + (offset - start_offset),
+ fp->_IO_read_end);
+ _IO_setp (fp, fp->_IO_buf_base, fp->_IO_buf_base);
+
_IO_mask_flags (fp, 0, _IO_EOF_SEEN);
goto resync;
}
-#endif
}
-#ifdef TODO
- INTUSE(_IO_unsave_markers) (fp);
-#endif
-
if (fp->_flags & _IO_NO_READS)
goto dumb;