Florian Weimer 659fe9fdd1 stdio-common: Introduce buffers for implementing printf
These buffers will eventually be used instead of FILE * objects
to implement printf functions.  The multibyte buffer is struct
__printf_buffer, the wide buffer is struct __wprintf_buffer.

To enable writing type-generic code, the header files
printf_buffer-char.h and printf_buffer-wchar_t.h define the
Xprintf macro differently, enabling Xprintf (buffer) to stand
for __printf_buffer and __wprintf_buffer as appropriate.  For
common cases, macros like Xprintf_buffer are provided as a more
syntactically convenient shortcut.

Buffer-specific flush callbacks are implemented with a switch
statement instead of a function pointer, to avoid hardening issues
similar to those of libio vtables.  struct __printf_buffer_as_file
is needed to support custom printf specifiers because the public
interface for that requires passing a FILE *, which is why there
is a trapdoor back from these buffers to FILE * streams.

Since the immediate user of these interfaces knows when processing
has finished, there is no flush callback for the end of processing,
only a flush callback for the intermediate buffer flush.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
2022-12-19 18:56:54 +01:00
..
2022-10-27 11:36:44 +02:00
2022-10-27 11:36:44 +02:00
2022-10-27 11:36:44 +02:00
2022-01-03 05:16:03 -08:00
2022-11-29 14:33:56 -08:00
2022-04-19 15:52:27 -07:00
2009-06-03 16:21:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2013-06-05 20:44:03 +00:00
2009-10-30 00:48:54 -07:00
2009-06-03 16:21:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-06-22 15:07:40 -07:00
2009-10-30 00:48:54 -07:00
2012-01-07 23:57:22 -05:00
2006-03-01 06:18:49 +00:00
2022-01-31 07:05:48 -08:00
2022-08-04 09:09:48 -03:00
2022-08-04 09:09:48 -03:00
2013-08-21 19:48:48 +02:00
2013-08-21 19:48:48 +02:00
2020-05-18 15:39:34 +02:00
2013-06-05 20:44:03 +00:00
2022-01-18 14:38:15 -03:00
2005-07-07 23:00:02 +00:00
2005-07-07 23:00:02 +00:00
2005-07-07 23:00:02 +00:00
2005-07-07 23:00:02 +00:00
2005-07-07 23:00:02 +00:00
2022-04-07 20:38:23 +02:00
2004-09-23 07:45:38 +00:00
2004-09-23 07:45:38 +00:00
2004-09-23 07:45:38 +00:00
2004-10-27 20:27:40 +00:00
2022-01-31 07:05:48 -08:00
2017-12-15 20:22:29 -08:00
2004-07-16 17:56:45 +00:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2022-04-26 10:16:11 -07:00
2013-10-18 19:45:36 +05:30
2011-09-10 14:34:15 -04:00
2011-09-10 14:34:15 -04:00
2011-09-10 14:34:15 -04:00
2005-03-20 22:25:59 +00:00
2022-01-22 17:31:16 +01:00
2006-03-01 06:18:49 +00:00
2005-03-03 08:28:23 +00:00
2005-03-03 08:28:23 +00:00
2005-03-03 08:28:23 +00:00
2005-03-03 08:28:23 +00:00
2005-03-18 10:54:53 +00:00
2005-03-18 10:54:53 +00:00
2005-04-27 01:39:11 +00:00
2011-08-24 09:32:13 +02:00
2006-03-01 06:18:49 +00:00
2022-01-22 17:31:16 +01:00