From cd1ab7548cc7d1486cae95870b4f8dde52fbee8b Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 11 Jul 2025 12:56:52 +0200 Subject: [PATCH] Rename `AsyncJsonWriter::Flush()` -> `MayFlush()` to reflect its usage --- lib/base/json.cpp | 2 +- lib/base/json.hpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/base/json.cpp b/lib/base/json.cpp index 00d114731..8149e3f82 100644 --- a/lib/base/json.cpp +++ b/lib/base/json.cpp @@ -242,7 +242,7 @@ void JsonEncoder::FlushIfSafe(boost::asio::yield_context* yc) const // cast the m_Writer to AsyncJsonWriter without any additional checks as it is guaranteed // to be an instance of AsyncJsonWriter when m_IsAsyncWriter is true. auto ajw(static_cast(m_Writer.get())); - ajw->Flush(*yc); + ajw->MayFlush(*yc); } } diff --git a/lib/base/json.hpp b/lib/base/json.hpp index 238c9bc53..badf4d7ef 100644 --- a/lib/base/json.hpp +++ b/lib/base/json.hpp @@ -17,7 +17,7 @@ namespace icinga * * All users of this class must ensure that the underlying output stream will not perform any asynchronous I/O * operations when the @c write_character() or @c write_characters() methods are called. They shall only perform - * such ops when the @c JsonEncoder allows them to do so by calling the @c Flush() method. + * such ops when the @c JsonEncoder allows them to do so by calling the @c MayFlush() method. * * @ingroup base */ @@ -25,7 +25,7 @@ class AsyncJsonWriter : public nlohmann::detail::output_adapter_protocol { public: /** - * Flush instructs the underlying output stream to write any buffered data to wherever it is supposed to go. + * It instructs the underlying output stream to write any buffered data to wherever it is supposed to go. * * The @c JsonEncoder allows the stream to even perform asynchronous operations in a safe manner by calling * this method with a dedicated @c boost::asio::yield_context object. The stream must not perform any async @@ -37,7 +37,7 @@ public: * * @param yield The yield context to use for asynchronous operations. */ - virtual void Flush(boost::asio::yield_context& yield) = 0; + virtual void MayFlush(boost::asio::yield_context& yield) = 0; }; class String;