apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: broken apr_brigade_cleanup?
Date Tue, 07 Dec 2004 17:03:40 GMT
Cliff Woolley wrote:
> On Tue, 7 Dec 2004, Stas Bekman wrote:
>>Well, I see why it was made like this. this is because of the cleanup
> 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.

As explained in the other reply, it's not this code that causes the crash, 
but (maybe) the wrapper that calls it. The wrapper is autogenerated based 
on the prototype. I have no details of the crash, I hate talking on behalf 
of someone, when I don't know the details :( All I know is that 'access 
violation' is reported on win32.

Anyway, all I'm now asking is to fix the prototype. Thank you.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

View raw message