httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug MacEachern <do...@covalent.net>
Subject Re: are we ready to roll?
Date Fri, 10 Aug 2001 00:25:07 GMT
On Thu, 9 Aug 2001, Cliff Woolley wrote:
 
> APR_BRIGADE_FOREACH is finicky... in order to access the next bucket on
> the next iteration, it assumes you didn't mess with the bucket pointer it
> gave you on the last iteration.  If you fiddle with the bucket pointer
> that APR_BRIGADE_FOREACH gave you rather than just treating as a constant
> value, you're almost certain to break the assumptions made by that macro.

yikes.  i guess i was doing that.
 
> Given the example you list above of what will work and what won't, I'm
> guessing that what your loop is doing is taking each bucket in the brigade
> one at a time, dinking with the contents (unencrypting them, perhaps),
> removing the bucket from the brigade, and re-injecting the data either
> into either a completely different bucket or possibly even into a
> different ("output") brigade.  That just won't work with
> APR_BRIGADE_FOREACH, because when you destroy the bucket it gave you
> during the course of one iteration, it has no way to find out what the
> APR_BUCKET_NEXT(bucket) value is in order to move on to the next bucket in
> the brigade.  (Did that make sense?  I'm rambling...)
> 
> The "while (!APR_BRIGADE_EMPTY(bb)) {}" trick is a very commonly-used way
> to avoid these sorts of problems when doing these sorts of things.  It
> probably deserves a big honkin @tip or @warning in the docco for
> APR_BRIGADE_FOREACH.  I'll go add one.  =-)

thanks for explaining.  big honking warning would be good.



Mime
View raw message