]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Cleanup: const correctness for SBuf iterators
authorAmos Jeffries <squid3@treenet.co.nz>
Wed, 10 Feb 2016 09:36:47 +0000 (22:36 +1300)
committerAmos Jeffries <squid3@treenet.co.nz>
Wed, 10 Feb 2016 09:36:47 +0000 (22:36 +1300)
The SBuf iterator has almost all properties of a const_iterator but the
begin/end methods producing it had the syntax for returning a non-const
iterator. This leads to several const related problems despite the
SBufIterator providing a const API:

 1) range-for loops cannot be used on const SBuf
 2) begin/end/rbegin/rend operators cannot be used on const SBuf

Also, the SBufIterator API for operator*() used a temporary char
which, wile const, allows the compiler to implicitly use move semantics
on the return value and allows some (thankfully unused) &*itr() syntax
to compile when it should not be possible.
To avoid even the potential of that causing hidden issues in future we
convert the operator*() to the API definition used widely within the STL
const_iterator's (const char &operator*() const).


Trivial merge