------------------------------------------------------------ revno: 13200 revision-id: rousskov@measurement-factory.com-20140101201116-8x39qph73c0rgcoi parent: squid3@treenet.co.nz-20131230104815-zjowevw20bv2ulzz committer: Alex Rousskov branch nick: trunk timestamp: Wed 2014-01-01 13:11:16 -0700 message: Added MemBlob::appended() method. Handy during out-of-band buffer manipulation. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: rousskov@measurement-factory.com-20140101201116-\ # 8x39qph73c0rgcoi # target_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # testament_sha1: f7d27277b6bae1b7107c8697fbfe4442448c3939 # timestamp: 2014-01-01 20:53:44 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/trunk/ # base_revision_id: squid3@treenet.co.nz-20131230104815-\ # zjowevw20bv2ulzz # # Begin patch === modified file 'src/MemBlob.cc' --- src/MemBlob.cc 2013-11-27 15:52:03 +0000 +++ src/MemBlob.cc 2014-01-01 20:11:16 +0000 @@ -128,6 +128,14 @@ } void +MemBlob::appended(const size_type n) +{ + Must(willFit(n)); + size += n; + ++Stats.append; +} + +void MemBlob::append(const char *source, const size_type n) { if (n > 0) { // appending zero bytes is allowed but only affects the stats === modified file 'src/MemBlob.h' --- src/MemBlob.h 2013-10-04 13:55:21 +0000 +++ src/MemBlob.h 2014-01-01 20:11:16 +0000 @@ -95,6 +95,13 @@ 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 *