Skip to content

Commit 1cb09d1

Browse files
committed
Cleanup format.h
1 parent 9bb14ff commit 1cb09d1

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

include/fmt/format-inl.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,17 @@ template <typename Locale> auto locale_ref::get() const -> Locale {
7575

7676
namespace 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+
7889
FMT_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.
111113
inline void fwrite_all(const void* ptr, size_t count, FILE* stream) {
112114
size_t written = std::fwrite(ptr, 1, count, stream);

include/fmt/format.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3805,13 +3805,6 @@ template <typename Char = char> struct format_handler {
38053805
FMT_NORETURN void on_error(const char* message) { report_error(message); }
38063806
};
38073807

3808-
using format_func = void (*)(detail::buffer<char>&, int, const char*);
3809-
FMT_API void do_report_error(format_func func, int error_code,
3810-
const char* message) noexcept;
3811-
3812-
FMT_API void format_error_code(buffer<char>& out, int error_code,
3813-
string_view message) noexcept;
3814-
38153808
template <typename T, typename Char, type TYPE>
38163809
template <typename FormatContext>
38173810
FMT_CONSTEXPR auto native_formatter<T, Char, TYPE>::format(

0 commit comments

Comments
 (0)