[PATCH] obstack_printf fix (fixes localedef)
Jakub Jelinek
jakub@redhat.com
Tue Jun 27 03:29:00 GMT 2000
Hi!
We cannot call obstack_blank, because we call then
_IO_str_init_static (&new_f.ofile.file.file, obstack_base (obstack),
size, obstack_next_free (obstack));
^^^^^^^^^^^^^^^^^^^^^^^^^^^
and obstack_next_free points to wrong place in that case (64bytes away from
where it should).
With this patch, obstack_printf seems to work just fine to me even in the
case where it is called with
obstack_object_size (obstack) == obstack_room (obstack) == 0.
2000-06-27 Jakub Jelinek <jakub@redhat.com>
* libio/obprintf.c (_IO_obstack_vprintf): Call obstack_make_room,
not obstack_blank.
--- libc/libio/obprintf.c.jj Tue Apr 4 01:32:57 2000
+++ libc/libio/obprintf.c Tue Jun 27 12:12:11 2000
@@ -144,14 +144,13 @@ _IO_obstack_vprintf (struct obstack *obs
/* We have to handle the allocation a bit different since the
`_IO_str_init_static' function would handle a size of zero
different from what we expect. */
- size = 64;
/* Get more memory. */
- obstack_blank (obstack, size);
+ obstack_make_room (obstack, 64);
- /* Recompute who much room we have. */
+ /* Recompute how much room we have. */
room = obstack_room (obstack);
- size += room;
+ size = room;
assert (size != 0);
}
Jakub
More information about the Libc-hacker
mailing list