[squid-dev] [PATCH] Ipc::MemMap::ttl removal

Amos Jeffries squid3 at treenet.co.nz
Mon Aug 8 14:12:29 UTC 2016


Coverity Scan latest checks are reporting that the ttl member of
Ipc::MemMap is being left uninitialized.

It sounds like something which would lead to major bugs. Except that it
turns out, AFAICS, that this ttl member is never actually being used.

Anyone have a reason not to simply drop it from the code?

Amos
-------------- next part --------------
=== modified file 'src/ipc/MemMap.h'
--- src/ipc/MemMap.h	2016-02-23 08:51:22 +0000
+++ src/ipc/MemMap.h	2016-08-08 13:58:49 +0000
@@ -107,41 +107,40 @@
     /// close slot after reading, decrements read level
     void closeForReading(const sfileno fileno);
 
     bool full() const; ///< there are no empty slots left
     bool valid(const int n) const; ///< whether n is a valid slot coordinate
     int entryCount() const; ///< number of used slots
     int entryLimit() const; ///< maximum number of slots that can be used
 
     /// adds approximate current stats to the supplied ones
     void updateStats(ReadWriteLockStats &stats) const;
 
     /// The cleaner MemMapCleaner::noteFreeMapSlot method called when a
     /// readable entry is freed.
     MemMapCleaner *cleaner;
 
 protected:
     static Owner *Init(const char *const path, const int limit, const size_t extrasSize);
 
     const SBuf path; ///< cache_dir path, used for logging
     Mem::Pointer<Shared> shared;
-    int ttl;
 
 private:
     int slotIndexByKey(const cache_key *const key) const;
     Slot &slotByKey(const cache_key *const key);
 
     Slot *openForReading(Slot &s);
     void abortWriting(const sfileno fileno);
     void freeIfNeeded(Slot &s);
     void freeLocked(Slot &s, bool keepLocked);
 };
 
 /// API for adjusting external state when dirty map slot is being freed
 class MemMapCleaner
 {
 public:
     virtual ~MemMapCleaner() {}
 
     /// adjust slot-linked state before a locked Readable slot is erased
     virtual void noteFreeMapSlot(const sfileno slotId) = 0;
 };



More information about the squid-dev mailing list