1 /* Flush a struct __printf_buffer. Multibyte version.
2 Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
20 #include <printf_buffer.h>
22 #include "printf_buffer-char.h"
23 #include "Xprintf_buffer_flush.c"
25 /* The __printf_buffer_flush_* functions are defined together with
26 functions that are pulled in by strong references. */
28 # pragma weak __printf_buffer_flush_snprintf
29 # pragma weak __printf_buffer_flush_to_file
30 # pragma weak __printf_buffer_flush_asprintf
31 # pragma weak __printf_buffer_flush_dprintf
32 # pragma weak __printf_buffer_flush_fp
33 # pragma weak __printf_buffer_flush_fp_to_wide
34 # pragma weak __printf_buffer_flush_fphex_to_wide
35 # pragma weak __printf_buffer_flush_obstack
39 __printf_buffer_do_flush (struct __printf_buffer
*buf
)
43 case __printf_buffer_mode_failed
:
44 case __printf_buffer_mode_sprintf
:
46 case __printf_buffer_mode_snprintf
:
47 __printf_buffer_flush_snprintf ((struct __printf_buffer_snprintf
*) buf
);
49 case __printf_buffer_mode_sprintf_chk
:
52 case __printf_buffer_mode_to_file
:
53 __printf_buffer_flush_to_file ((struct __printf_buffer_to_file
*) buf
);
55 case __printf_buffer_mode_asprintf
:
56 __printf_buffer_flush_asprintf ((struct __printf_buffer_asprintf
*) buf
);
58 case __printf_buffer_mode_dprintf
:
59 __printf_buffer_flush_dprintf ((struct __printf_buffer_dprintf
*) buf
);
61 case __printf_buffer_mode_strfmon
:
63 __printf_buffer_mark_failed (buf
);
65 case __printf_buffer_mode_fp
:
66 __printf_buffer_flush_fp ((struct __printf_buffer_fp
*) buf
);
68 case __printf_buffer_mode_fp_to_wide
:
69 __printf_buffer_flush_fp_to_wide
70 ((struct __printf_buffer_fp_to_wide
*) buf
);
72 case __printf_buffer_mode_fphex_to_wide
:
73 __printf_buffer_flush_fphex_to_wide
74 ((struct __printf_buffer_fphex_to_wide
*) buf
);
76 case __printf_buffer_mode_obstack
:
77 __printf_buffer_flush_obstack ((struct __printf_buffer_obstack
*) buf
);