/* Print output of stream to given obstack.
- Copyright (C) 1996 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.
struct _IO_obstack_file
{
- struct _IO_FILE file;
- const void *vtable;
+ struct _IO_FILE_plus file;
struct obstack *obstack;
};
/* 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);
{
/* 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);
}
else
- {
- memcpy (fp->_IO_write_ptr, data, n);
- fp->_IO_write_ptr += n;
- }
+ fp->_IO_write_ptr = __mempcpy (fp->_IO_write_ptr, data, n);
return n;
}
JUMP_INIT(write, NULL),
JUMP_INIT(seek, NULL),
JUMP_INIT(close, NULL),
- JUMP_INIT(stat, NULL)
+ JUMP_INIT(stat, NULL),
+ JUMP_INIT(showmanyc, NULL),
+ JUMP_INIT(imbue, NULL)
};
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_no_init (&new_f.ofile.file.file, 0, -1, NULL, NULL);
_IO_JUMPS (&new_f.ofile.file) = &_IO_obstack_jumps;
- _IO_str_init_static (&new_f.ofile.file, obstack_base (obstack),
+ _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;
}
+#ifdef weak_alias
weak_alias (_IO_obstack_vprintf, obstack_vprintf)
+#endif
int
va_end (ap);
return result;
}
+#ifdef weak_alias
weak_alias (_IO_obstack_printf, obstack_printf)
+#endif