From: Joel Rosdahl Date: Mon, 30 Sep 2019 18:37:03 +0000 (+0200) Subject: Rename AtomicFile::close to commit X-Git-Tag: v4.0~760 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1616fc7f210695a0a2692c7ba9b216613b589155;p=thirdparty%2Fccache.git Rename AtomicFile::close to commit This better conveys the semantics. --- diff --git a/src/AtomicFile.cpp b/src/AtomicFile.cpp index 6edc1157e..ab63e0b2a 100644 --- a/src/AtomicFile.cpp +++ b/src/AtomicFile.cpp @@ -37,7 +37,7 @@ AtomicFile::AtomicFile(const std::string& path, Mode mode) : m_path(path) AtomicFile::~AtomicFile() { if (m_stream) { - // close() was not called so remove the lingering temporary file. + // commit() was not called so remove the lingering temporary file. fclose(m_stream); tmp_unlink(m_tmp_path.c_str()); } @@ -62,7 +62,7 @@ AtomicFile::write(const std::vector& data) } void -AtomicFile::close() +AtomicFile::commit() { assert(m_stream); fclose(m_stream); diff --git a/src/AtomicFile.hpp b/src/AtomicFile.hpp index 23e9c4e67..546a765bb 100644 --- a/src/AtomicFile.hpp +++ b/src/AtomicFile.hpp @@ -40,7 +40,7 @@ public: // Close the temporary file and rename it to the destination file. Note: The // destructor will not do this automatically to avoid half-written data in the // file. - void close(); + void commit(); private: const std::string m_path; diff --git a/src/Config.cpp b/src/Config.cpp index 622ad11d3..1ca7f9e9a 100644 --- a/src/Config.cpp +++ b/src/Config.cpp @@ -622,7 +622,7 @@ Config::set_value_in_file(const std::string& path, output.write(fmt::format("{} = {}\n", key, value)); } - output.close(); + output.commit(); } void