Joe Schaefer wrote:
[...]
Instead of iterating using for(;;), use while():
 while ($b = $bb->first) {
     ++$seen_eos, last if $b->is_eos;
     if ($b->read(my $buf)) {
         $data .= $buf;
     }
     $b->delete; # APR::Bucket needs to wrap apr_bucket_delete(),
# since APR_BUCKET_REMOVE() doesn't actually
                 # decrement the bucket refcount
                 # so the bucket allocator can reclaim $b
 }

I've been explicitly rewriting the iteration loops recently not to use the
while loop, because for anything more complicated it becomes a mess and too
easy to put $b->delete in the wrong place.


OK, but don't call $b->remove, because its not doing anything
useful. Leave the buckets in the brigade and call $bb->cleanup after each inner for() loop, that way the next call to get_brigade
will be able to reuse those buckets (if at all possible).

Heh, I tried that (removing $b->remove), and t/compat/request_body.t then segfaults right there, all by itself.


--
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to