apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: cvs commit: apr-util/include apr_buckets.h
Date Fri, 10 Aug 2001 18:56:49 GMT
On 10 Aug 2001 rbb@apache.org wrote:

>   +/**
>   + * Remove all zero length buckets from the brigade.
>   + * @param b The bucket brigade
>   + */
>   +#define APR_BRIGADE_NORMALIZE(b)       \
>   +    do {  \
>   +        apr_bucket *e; \
>   +        e = APR_BRIGADE_FIRST(b); \
>   +        if (e->length == 0) { \
>   +            apr_bucket *d; \
>   +            d = APR_BUCKET_NEXT(e); \
>   +            apr_bucket_delete(e); \
>   +            e = d; \
>   +        } \
>   +        e = APR_BUCKET_NEXT(e); \
>   +    } while (e != APR_BRIGADE_SENTINEL(b))
>   +
>    /*
>     * General-purpose reference counting for the various bucket types.
>     *

What if you call this on a brigade that's already empty?  You'll probably
segfault.  You should move the while test up to the top of the loop, I
think.

--Cliff

--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message