diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-04-12 23:00:37 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-04-12 23:00:37 +0000 |
commit | 2799531132f564a4681d7fd8c3b4c71a474d86a1 (patch) | |
tree | 5640b6521643d9f0b687c40f0620dd272baf2b74 | |
parent | 97119860964ea61ba999d8ce9434e83a56a96ba9 (diff) | |
download | glibc-2799531132f564a4681d7fd8c3b4c71a474d86a1.tar glibc-2799531132f564a4681d7fd8c3b4c71a474d86a1.tar.gz glibc-2799531132f564a4681d7fd8c3b4c71a474d86a1.tar.bz2 glibc-2799531132f564a4681d7fd8c3b4c71a474d86a1.zip |
Update.
1999-04-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
* libio/obprintf.c (_IO_obstack_overflow): Put the write end at
the real end of the chunk, not some random point inbetween.
(_IO_obstack_xsputn): Likewise. Actually copy the data into the
obstack when growing. Use fast version of obstack_blank when
shrinking.
(struct _IO_obstack_file): Use _IO_FILE_plus instead of explicitly
allocating the vtable pointer.
(_IO_obstack_vprintf): Adjust for above change and avoid
unnecessary casts. Use fast version of obstack_blank when
shrinking.
Fixes PR libc/1075.
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | NEWS | 6 | ||||
-rw-r--r-- | libio/obprintf.c | 37 |
3 files changed, 37 insertions, 20 deletions
@@ -1,3 +1,17 @@ +1999-04-13 Andreas Schwab <schwab@issan.cs.uni-dortmund.de> + + * libio/obprintf.c (_IO_obstack_overflow): Put the write end at + the real end of the chunk, not some random point inbetween. + (_IO_obstack_xsputn): Likewise. Actually copy the data into the + obstack when growing. Use fast version of obstack_blank when + shrinking. + (struct _IO_obstack_file): Use _IO_FILE_plus instead of explicitly + allocating the vtable pointer. + (_IO_obstack_vprintf): Adjust for above change and avoid + unnecessary casts. Use fast version of obstack_blank when + shrinking. + Fixes PR libc/1075. + 1999-04-12 Ulrich Drepper <drepper@cygnus.com> * iconvdata/gconv-modules: Fix typo. Add UJIS alias. @@ -9,7 +9,11 @@ Please send GNU C library bug reports using the `glibcbug' script to Version 2.1.1 -* New ISO C 9x function _exit, imaxabs, and imaxdiv are added. +* New ISO C 9x function _Exit, imaxabs, and imaxdiv are added. + +* New xdr functions are added. + +* Fixed a number of bugs and incompatibilities with glibc 2.0. Version 2.1 diff --git a/libio/obprintf.c b/libio/obprintf.c index a4d685a927..0e947b25ad 100644 --- a/libio/obprintf.c +++ b/libio/obprintf.c @@ -1,5 +1,5 @@ /* Print output of stream to given obstack. - Copyright (C) 1996, 1997 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. @@ -31,8 +31,7 @@ struct _IO_obstack_file { - struct _IO_FILE file; - const void *vtable; + struct _IO_FILE_plus file; struct obstack *obstack; }; @@ -50,7 +49,7 @@ _IO_obstack_overflow (_IO_FILE *fp, int c) /* Setup the buffer pointers again. */ fp->_IO_write_base = obstack_base (obstack); fp->_IO_write_ptr = obstack_next_free (obstack); - fp->_IO_write_end = fp->_IO_write_base + obstack_room (obstack); + fp->_IO_write_end = fp->_IO_write_ptr + obstack_room (obstack); /* Now allocate the rest of the current chunk. */ obstack_blank_fast (obstack, fp->_IO_write_end - fp->_IO_write_ptr); @@ -67,15 +66,15 @@ _IO_obstack_xsputn (_IO_FILE *fp, const void *data, _IO_size_t n) { /* We need some more memory. First shrink the buffer to the space we really currently need. */ - obstack_blank (obstack, fp->_IO_write_ptr - fp->_IO_write_end); + obstack_blank_fast (obstack, fp->_IO_write_ptr - fp->_IO_write_end); - /* Now grow for N bytes. */ - obstack_blank (obstack, n); + /* Now grow for N bytes, and put the data there. */ + obstack_grow (obstack, data, n); /* Setup the buffer pointers again. */ fp->_IO_write_base = obstack_base (obstack); fp->_IO_write_ptr = obstack_next_free (obstack); - fp->_IO_write_end = (fp->_IO_write_base + obstack_room (obstack)); + fp->_IO_write_end = (fp->_IO_write_ptr + obstack_room (obstack)); /* Now allocate the rest of the current chunk. */ obstack_blank_fast (obstack, fp->_IO_write_end - fp->_IO_write_ptr); } @@ -125,25 +124,25 @@ _IO_obstack_vprintf (struct obstack *obstack, const char *format, va_list args) int result; #ifdef _IO_MTSAFE_IO - new_f.ofile.file._lock = &new_f.lock; + new_f.ofile.file.file._lock = &new_f.lock; #endif - _IO_init ((_IO_FILE *) &new_f.ofile, 0); - _IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps; - _IO_str_init_static (&new_f.ofile.file, obstack_base (obstack), - (obstack_object_size (obstack) + - obstack_room (obstack)), obstack_next_free (obstack)); + _IO_init (&new_f.ofile.file.file, 0); + _IO_JUMPS (&new_f.ofile.file.file) = &_IO_obstack_jumps; + _IO_str_init_static (&new_f.ofile.file.file, obstack_base (obstack), + obstack_object_size (obstack) + obstack_room (obstack), + obstack_next_free (obstack)); /* Now allocate the rest of the current chunk. */ obstack_blank_fast (obstack, - (new_f.ofile.file._IO_write_end - - new_f.ofile.file._IO_write_ptr)); + (new_f.ofile.file.file._IO_write_end + - new_f.ofile.file.file._IO_write_ptr)); new_f.ofile.obstack = obstack; - result = _IO_vfprintf ((_IO_FILE *) &new_f, format, args); + result = _IO_vfprintf (&new_f.ofile.file.file, format, args); /* Shrink the buffer to the space we really currently need. */ - obstack_blank (obstack, (new_f.ofile.file._IO_write_ptr - - new_f.ofile.file._IO_write_end)); + obstack_blank_fast (obstack, (new_f.ofile.file.file._IO_write_ptr + - new_f.ofile.file.file._IO_write_end)); return result; } |