]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Added MemBlob::appended() method. Handy during out-of-band buffer manipulation.
authorAlex Rousskov <rousskov@measurement-factory.com>
Wed, 1 Jan 2014 20:11:16 +0000 (13:11 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Wed, 1 Jan 2014 20:11:16 +0000 (13:11 -0700)
src/MemBlob.cc
src/MemBlob.h

index 3234215695a87d14be3fd5baf5194001f824e323..cc83aa9cd3578e61947b2d353fe7b5c8e555666b 100644 (file)
@@ -127,6 +127,14 @@ MemBlob::memAlloc(const size_type minSize)
     Stats.liveBytes += capacity;
 }
 
+void
+MemBlob::appended(const size_type n)
+{
+    Must(willFit(n));
+    size += n;
+    ++Stats.append;
+}
+
 void
 MemBlob::append(const char *source, const size_type n)
 {
index 804e0a6442c8cf5238855d1799847e6909be6207..c4f0fa1fc3977769b23554d8ec527986e0804d7d 100644 (file)
@@ -95,6 +95,13 @@ public:
         return isAppendOffset(off) && willFit(n);
     }
 
+    /** adjusts internal object state as if exactly n bytes were append()ed
+     *
+     * \throw TextException if there was not enough space in the blob
+     * \param n the number of bytes that were appended
+     */
+    void appended(const size_type n);
+
     /** copies exactly n bytes from the source to the available space area,
      *  enlarging the used area by n bytes
      *