]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Fix some trivial code style issues
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 31 May 2020 10:52:44 +0000 (12:52 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 31 May 2020 10:52:44 +0000 (12:52 +0200)
src/InodeCache.cpp
src/InodeCache.hpp
src/Util.cpp

index 46dcd8ad072b623ce4debcbff8bc5f71480a9d1a..9a49e8795de1267419530798045c09195fe29f3c 100644 (file)
@@ -152,8 +152,8 @@ InodeCache::mmap_file(const std::string& inode_cache_file)
   // allow a new file to be generated.
   if (sr->version != k_version) {
     cc_log(
-      "Dropping inode cache because found version %u does not match expected "
-      "version %u",
+      "Dropping inode cache because found version %u does not match expected"
+      " version %u",
       sr->version,
       k_version);
     munmap(sr, sizeof(SharedRegion));
@@ -208,8 +208,9 @@ InodeCache::acquire_bucket(uint32_t index)
   int err = pthread_mutex_lock(&bucket->mt);
 #  ifdef PTHREAD_MUTEX_ROBUST
   if (err == EOWNERDEAD) {
-    if (m_config.debug())
+    if (m_config.debug()) {
       ++m_sr->errors;
+    }
     err = pthread_mutex_consistent(&bucket->mt);
     if (err) {
       cc_log(
@@ -258,8 +259,8 @@ InodeCache::create_new_file(const std::string& filename)
   bool is_nfs;
   if (Util::is_nfs_fd(temp_fd.first, &is_nfs) == 0 && is_nfs) {
     cc_log(
-      "Inode cache not supported because the cache file would be located on "
-      "nfs: %s",
+      "Inode cache not supported because the cache file would be located on"
+      " nfs: %s",
       filename.c_str());
     unlink(temp_fd.second.c_str());
     close(temp_fd.first);
@@ -347,8 +348,7 @@ InodeCache::initialize()
   return false;
 }
 
-InodeCache::InodeCache(const Config& config)
-  : m_config(config), m_sr(nullptr), m_failed(false)
+InodeCache::InodeCache(const Config& config) : m_config(config)
 {
 }
 
index 3f45ca2f32352b132cc5215cb3d76ef666e91366..b1633a8fd0b587b19ed12bf64487808c5ffb10cd 100644 (file)
@@ -107,7 +107,7 @@ private:
   bool initialize();
 
   const Config& m_config;
-  struct SharedRegion* m_sr;
-  bool m_failed;
+  struct SharedRegion* m_sr = nullptr;
+  bool m_failed = false;
 };
 #endif
index d69cc29199c3cb273574f3c1645d0d7ec55ed351..2aa55b68283f71bab31d3e249c2d56379b9dde29 100644 (file)
@@ -441,7 +441,7 @@ is_nfs_fd(int fd, bool* is_nfs)
 #  ifdef HAVE_LINUX_FS_H
   *is_nfs = buf.f_type == NFS_SUPER_MAGIC;
 #  else // Mac OS X and some other BSD flavors
-  *is_nfs = !strcmp(buf.f_fstypename, "nfs");
+  *is_nfs = strcmp(buf.f_fstypename, "nfs") == 0;
 #  endif
   return 0;
 }