------------------------------------------------------------ revno: 14096 revision-id: squid3@treenet.co.nz-20161009155558-k3n240qhklo0uf2h parent: squid3@treenet.co.nz-20161009143011-e8ecg17lw1br0h3l author: Alex Rousskov committer: Amos Jeffries branch nick: 3.5 timestamp: Mon 2016-10-10 04:55:58 +1300 message: Optimized/simplified buffering: Appending nothing is always possible. This change avoids CoW when appending an empty buffer to MemBlob or SBuf, making "if !empty then append()" caller complications unnecessary. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20161009155558-k3n240qhklo0uf2h # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # testament_sha1: 7b4b0e8e03ed82b0d88f55ea4f5c0acb6b17a889 # timestamp: 2016-10-09 16:18:52 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.5 # base_revision_id: squid3@treenet.co.nz-20161009143011-\ # e8ecg17lw1br0h3l # # Begin patch === modified file 'src/MemBlob.h' --- src/MemBlob.h 2016-01-01 00:14:27 +0000 +++ src/MemBlob.h 2016-10-09 15:55:58 +0000 @@ -72,7 +72,7 @@ */ bool canAppend(const size_type off, const size_type n) const { // TODO: ignore offset (and adjust size) when the blob is not shared? - return isAppendOffset(off) && willFit(n); + return (isAppendOffset(off) && willFit(n)) || !n; } /** adjusts internal object state as if exactly n bytes were append()ed