]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use signed type for StoreMapSliceId because we use -1 as an "unset" value.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 20 Jan 2013 01:50:52 +0000 (18:50 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 20 Jan 2013 01:50:52 +0000 (18:50 -0700)
Initialize slice.next to be "unset". This should not be necessary in most
cases, but reduces the probability that a half-made writeable entry cannot be
freed properly because it contains an invalid slice.next value.

Losing the bit to store ID sign is not a big deal: Since slices always contain
non-trivial number of bytes for metadata, it is unlikely that all 32 (but less
than 33) bits would be required to store slice IDs in the future.

src/ipc/StoreMap.h

index a8975301fb0aa2c040cfa6a069f5fa35a83f2be4..19c699076126b36bd56ef78d3aff983909146e98 100644 (file)
@@ -9,13 +9,13 @@
 namespace Ipc
 {
 
-typedef uint32_t StoreMapSliceId;
+typedef int32_t StoreMapSliceId;
 
 /// a piece of Store entry, linked to other pieces, forming a chain
 class StoreMapSlice
 {
 public:
-    StoreMapSlice(): next(0), size(0) {}
+    StoreMapSlice(): next(-1), size(0) {}
 
     StoreMapSliceId next; ///< ID of the next slice occupied by the entry
     uint32_t size; ///< slice contents size