]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Rename AtomicFile::close to commit
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 30 Sep 2019 18:37:03 +0000 (20:37 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sat, 5 Oct 2019 21:16:46 +0000 (23:16 +0200)
This better conveys the semantics.

src/AtomicFile.cpp
src/AtomicFile.hpp
src/Config.cpp

index 6edc1157ebdaf8e4b1a9f7887418c9b5b61b1e06..ab63e0b2ab3d257959127334b30dd588c56560f9 100644 (file)
@@ -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<uint8_t>& data)
 }
 
 void
-AtomicFile::close()
+AtomicFile::commit()
 {
   assert(m_stream);
   fclose(m_stream);
index 23e9c4e67643071be78a363a1feeba012d42e366..546a765bbad5a9fb0b361cf375ac63c03fcca895 100644 (file)
@@ -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;
index 622ad11d3c7730d6058e1f1f0100714fde584370..1ca7f9e9afbc5abd06203b392158c846656e3551 100644 (file)
@@ -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