]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/DescriptorSet.cc
Docs: Copyright updates for 2018 (#114)
[thirdparty/squid.git] / src / DescriptorSet.cc
index f6fa19abc9ab44207e2a0a391c2a199f9688e435..f1be8d6202260fc7f9295b3a2c519997701bc779 100644 (file)
@@ -1,14 +1,20 @@
 /*
- * $Id$
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
  *
- * DEBUG: section 05    Comm
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
  */
-#include "config.h"
+
+/* DEBUG: section 05    Comm */
+
+#include "squid.h"
 #include "DescriptorSet.h"
+#include "globals.h" /* for Squid_MaxFD */
 
 // pre-allocates descriptor store and index for Squid_MaxFD descriptors
 DescriptorSet::DescriptorSet(): descriptors_(NULL), index_(NULL),
-        capacity_(0), size_(0)
+    capacity_(0), size_(0)
 {
     // we allocate once and never realloc, at least for now
     capacity_ = Squid_MaxFD;
@@ -37,7 +43,8 @@ DescriptorSet::add(int fd)
         return false; // already have it
 
     assert(size_ < capacity_); // \todo: replace with Must()
-    const int pos = size_++;
+    const int pos = size_;
+    ++size_;
     index_[fd] = pos;
     descriptors_[pos] = fd;
     return true; // really added
@@ -93,3 +100,4 @@ DescriptorSet::print(std::ostream &os) const
     // \todo add "name" if the set is used for more than just half-closed FDs
     os << size_ << " FDs";
 }
+