Jim Gallacher wrote ..
> Graham Dumpleton wrote:
> > The next section of code has:
> >
> > b = APR_BRIGADE_FIRST(self->bb_in);
> >
> > if (b == APR_BRIGADE_SENTINEL(self->bb_in))
> > return PyString_FromString("");
> >
> > Now I am assuming here that the check with APR_BRIGADE_SENTINEL() is
> > equivalent to APR_BRIGADE_EMPTY(bb). Yes/No? Would be nice to know
> > that they are. If it isn't then is an empty bucket brigade being handled?
>
> I'm a little fuzzy right now, so I can't really say. I think we should
> either add a comment to MODPYTHON-102 or create a new issue so we don't
> loose track of this potential problem.
Looking at it a bit more, it should be okay.
#define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link)
#define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list)
#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket,
link)
#define APR_RING_EMPTY(hp, elem, link) \
(APR_RING_FIRST((hp)) == APR_RING_SENTINEL((hp), elem, link))
Ie., the macro APR_BRIGADE_EMPTY() expands to the exact same test of
checking the first element against the sentinel.
Graham