From 5d27fb85fc3d482f10aa7b5fab900beb1d4a0e92 Mon Sep 17 00:00:00 2001 From: Johannes Stoelp Date: Wed, 18 Oct 2023 18:35:28 +0200 Subject: log: replace fprintf with fwrite --- log.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'log.h') diff --git a/log.h b/log.h index 8bb53c6..6aca9ea 100644 --- a/log.h +++ b/log.h @@ -167,11 +167,11 @@ constexpr void logger::log(const char* fmt, assert(pos < BufSize); // Ensure terminated with new line and null terminator. - assert(pos < BufSize - 1); - m_buf[pos++] = '\0'; + assert(pos < BufSize); + m_buf[pos++] = '\n'; // Write out log message. - std::fprintf(stderr, "%s\n", m_buf); + std::fwrite(m_buf, pos < BufSize ? pos : BufSize, 1 /* nmemb */, stderr); } } // namespace logging -- cgit v1.2.3