]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
chore: Tweak formatting and comments
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 12 Feb 2024 20:35:15 +0000 (21:35 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 12 Feb 2024 20:35:15 +0000 (21:35 +0100)
doc/MANUAL.adoc
src/Config.hpp
src/InodeCache.cpp
src/util/MemoryMap.hpp

index 787f1be4b45f0465091459bf9e2e129e505bcdeb..3372187f14fd611b87cf50cfc165426a493ae7e3 100644 (file)
@@ -832,7 +832,8 @@ might be incorrect.
     requires <<config_temporary_dir,*temporary_dir*>> to be located on a local
     filesystem of a supported type.
 +
-NOTE: Support for the inode cache feature on Windows is experimental. On Windows the default is false.
+NOTE: Support for the inode cache feature on Windows is experimental. On Windows
+the default is false.
 
 [#config_keep_comments_cpp]
 *keep_comments_cpp* (*CCACHE_COMMENTS* or *CCACHE_NOCOMMENTS*, see _<<Boolean values>>_ above)::
index cabf5920865e701d8a7602fa50bc5bc61324d3f0..17015526e43133bb08a55d36ba9e89fdcfddc6ed 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2019-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2019-2024 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -192,7 +192,7 @@ private:
 #ifndef _WIN32
   bool m_inode_cache = true;
 #else
-  // Support is experimental on Windows so usage is off by default
+  // Support is experimental on Windows so usage is off by default.
   bool m_inode_cache = false;
 #endif
   bool m_keep_comments_cpp = false;
index 0cc4e59df6bb0995268bd60c6099f685c8750217..1f86f52237dd251c6c7d063757ba48dbd693c5df 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020-2023 Joel Rosdahl and other contributors
+// Copyright (C) 2020-2024 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -52,6 +52,8 @@
 #include <type_traits>
 #include <vector>
 
+using pstr = util::PathString;
+
 // The inode cache resides on a file that is mapped into shared memory by
 // running processes. It is implemented as a two level structure, where the top
 // level is a hash table consisting of buckets. Each bucket contains entries
@@ -159,10 +161,9 @@ fd_is_on_known_to_work_file_system(int fd)
     return false;
   }
 
-  // Try to get information about remote protocol for this file.
-  // If the call succeeds, this is a remote file.
-  // If the call fails with invalid parameter error, consider that it is a local
-  // file
+  // Try to get information about remote protocol for this file. If the call
+  // succeeds, this is a remote file. If the call fails with invalid parameter
+  // error, consider whether it is a local file.
   FILE_REMOTE_PROTOCOL_INFO infos;
   if (GetFileInformationByHandleEx(
         file, FileRemoteProtocolInfo, &infos, sizeof(infos))) {
@@ -320,7 +321,7 @@ InodeCache::hash_inode(const std::string& path,
   key.st_ino = de.inode();
   key.st_mode = de.mode();
   // Note: Manually copying sec and nsec of mtime and ctime to prevent copying
-  // the padding bytes
+  // the padding bytes.
   auto mtime = de.mtime().to_timespec();
   key.st_mtim.tv_sec = mtime.tv_sec;
   key.st_mtim.tv_nsec = mtime.tv_nsec;
@@ -377,8 +378,7 @@ InodeCache::create_new_file(const std::string& filename)
     return false;
   }
 
-  util::Finalizer temp_file_remover(
-    [&] { unlink(util::PathString(tmp_file->path).c_str()); });
+  util::Finalizer temp_file_remover([&] { unlink(pstr(tmp_file->path)); });
 
   if (!fd_is_on_known_to_work_file_system(*tmp_file->fd)) {
     return false;
@@ -425,7 +425,7 @@ InodeCache::create_new_file(const std::string& filename)
     unsigned error = GetLastError();
     if (error == ERROR_FILE_EXISTS) {
       // Not an error, another process won the race. Remove the file we just
-      // created
+      // created.
       DeleteFileA(util::PathString(tmp_file->path).c_str());
       LOG("Another process created inode cache {}", filename);
       return true;
index 2fba3f9db9941efc60707f1f8463fb91dceccc73..91025b14cc6815b91b8d312e34b28c5143687385 100644 (file)
@@ -31,6 +31,7 @@ class MemoryMap : util::NonCopyable
 public:
   MemoryMap() = default;
   ~MemoryMap();
+
   MemoryMap(MemoryMap&& other) noexcept;
   MemoryMap& operator=(MemoryMap&& other) noexcept;
 
@@ -49,4 +50,5 @@ private:
     nullptr; // On Windows a handle on a file mapping is needed
 #endif
 };
+
 } // namespace util