From: Alex Rousskov Date: Wed, 1 Jan 2014 20:11:16 +0000 (-0700) Subject: Added MemBlob::appended() method. Handy during out-of-band buffer manipulation. X-Git-Tag: SQUID_3_5_0_1~445 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6bba9bf17b372bc3d9606aa0f165b2c2dfb37653;p=thirdparty%2Fsquid.git Added MemBlob::appended() method. Handy during out-of-band buffer manipulation. --- diff --git a/src/MemBlob.cc b/src/MemBlob.cc index 3234215695..cc83aa9cd3 100644 --- a/src/MemBlob.cc +++ b/src/MemBlob.cc @@ -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) { diff --git a/src/MemBlob.h b/src/MemBlob.h index 804e0a6442..c4f0fa1fc3 100644 --- a/src/MemBlob.h +++ b/src/MemBlob.h @@ -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 *