Re: Vector refactor, part 3: stack

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Wed, 12 Feb 2014 14:06:44 +1300

On 2014-02-12 04:45, Kinkie wrote:
> Hi,
> the attached patch is the missing piece of Vector refactoring: it
> replaces users of Stack with std::stack (or std::vector, in one case
> where it's needed due to also needing to iterate over the elements),
> and removes Vector, Stack and related unit tests.
>
> Farm-build-tested and run-tested.
> Code at lp:~squid/squid/stack-refactor.
>
> I've had a strange assert (at HttpHeader.cc:1551, in
> ~HttpHeaderEntry), but I could not reproduce that nor find anything in
> p2 or p3 of the refactor patch which may trigger it.
> I'm running more tests at full debugging.

In src/store.cc:
* the storeLateRelease
  - please move "int i" declaration to the for loop parameters.
  - the LateReleaseStack does not have NULL pointers in it so you can
combine the two if-statements:

      for (int i = 0; i < 10; ++i) {
         if (LateReleaseStack.empty()) {
              debugs(20, DBG_IMPORTANT, "storeLateRelease: released " <<
n << " objects");
              return;
         } else {
             e = LateReleaseStack.top();
             LateReleaseStack.pop();
         }

          e->unlock("storeLateRelease");
          ++n;
      }

+1. The above can be done on commit.

Amos
Received on Wed Feb 12 2014 - 01:06:56 MST

This archive was generated by hypermail 2.2.0 : Wed Feb 12 2014 - 12:00:12 MST