mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-05 19:35:52 +03:00
libio: Convert __vasprintf_internal to buffers
The buffer resizing algorithm is slightly different. The initial buffer is on the stack, and small buffers are directly allocated on the heap using the exact required size. The overhead of the additional copy is compensated by the lowered setup cost for buffers compared to libio streams. Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#ifndef SHARED
|
||||
# pragma weak __printf_buffer_flush_snprintf
|
||||
# pragma weak __printf_buffer_flush_to_file
|
||||
# pragma weak __printf_buffer_flush_asprintf
|
||||
# pragma weak __printf_buffer_flush_fp
|
||||
# pragma weak __printf_buffer_flush_fp_to_wide
|
||||
# pragma weak __printf_buffer_flush_fphex_to_wide
|
||||
@@ -49,6 +50,9 @@ __printf_buffer_do_flush (struct __printf_buffer *buf)
|
||||
case __printf_buffer_mode_to_file:
|
||||
__printf_buffer_flush_to_file ((struct __printf_buffer_to_file *) buf);
|
||||
return;
|
||||
case __printf_buffer_mode_asprintf:
|
||||
__printf_buffer_flush_asprintf ((struct __printf_buffer_asprintf *) buf);
|
||||
return;
|
||||
case __printf_buffer_mode_strfmon:
|
||||
__set_errno (E2BIG);
|
||||
__printf_buffer_mark_failed (buf);
|
||||
|
Reference in New Issue
Block a user