apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <jwool...@virginia.edu>
Subject Re: broken apr_brigade_cleanup?
Date Tue, 07 Dec 2004 16:53:08 GMT
On Tue, 7 Dec 2004, Stas Bekman wrote:

> Well, I see why it was made like this. this is because of the cleanup
> wrapper:

Originally apr_brigade_cleanup() itself was the pool cleanup callback and
thus the void* argument type was necessary.  Later on it was causing
badness on Win32 due (I think) to the APU_DECLARE(), so somebody added
that wrapper function brigade_cleanup() to fix the problem.  The void*
type remained the same because nobody thought it was a problem.

> > APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data)
> > {
> >     apr_bucket_brigade *b = data;
> >     apr_bucket *e;
> >
> > shouldn't it be:
> >
> >     apr_bucket_brigade *b = (apr_bucket_brigade *)data;
> >

Well that's just absurd.  The cast you show here should produce *zero*
difference in the generated code.  The only difference should be how the
compiler's type checker views that statement.  But this is C, not C++.
void* is implicitly compatible with any other pointer type with the same
qualifiers and level of indirection.  Thus there should be no difference
*at all*.

Can you check that (a) it is being compiled as C and not C++
[though if it were being compiled as C++, the above should be an
error since it would be assignment from an incompatible pointer
type], and then (b) compile the two versions and look at the assembly and
tell me what's different about them?  Because I just don't understand how
this could cause a crash.


View raw message