@@ -75,6 +75,17 @@ template <typename Locale> auto locale_ref::get() const -> Locale {
7575
7676namespace detail {
7777
78+ using format_func = void (*)(detail::buffer<char >&, int , const char *);
79+
80+ FMT_FUNC void do_report_error (format_func func, int error_code,
81+ const char * message) noexcept {
82+ memory_buffer full_message;
83+ func (full_message, error_code, message);
84+ // Don't use fwrite_all because the latter may throw.
85+ if (std::fwrite (full_message.data (), full_message.size (), 1 , stderr) > 0 )
86+ std::fputc (' \n ' , stderr);
87+ }
88+
7889FMT_FUNC void format_error_code (detail::buffer<char >& out, int error_code,
7990 string_view message) noexcept {
8091 // Report error code making sure that the output fits into
@@ -98,15 +109,6 @@ FMT_FUNC void format_error_code(detail::buffer<char>& out, int error_code,
98109 FMT_ASSERT (out.size () <= inline_buffer_size, " " );
99110}
100111
101- FMT_FUNC void do_report_error (format_func func, int error_code,
102- const char * message) noexcept {
103- memory_buffer full_message;
104- func (full_message, error_code, message);
105- // Don't use fwrite_all because the latter may throw.
106- if (std::fwrite (full_message.data (), full_message.size (), 1 , stderr) > 0 )
107- std::fputc (' \n ' , stderr);
108- }
109-
110112// A wrapper around fwrite that throws on error.
111113inline void fwrite_all (const void * ptr, size_t count, FILE* stream) {
112114 size_t written = std::fwrite (ptr, 1 , count, stream);
0 commit comments