Carl Brewer wrote:
Stas Bekman wrote:
yup, that's strange. Any difference if you drop (STRLEN):
- char *buf = SvPV(*MARK, (STRLEN)wlen); + char *buf = SvPV(*MARK, wlen);
Drop the cast, and lo! I have a new mod_perl binary :)
Yeah, but that's not good. Since that patch:
http://cvs.apache.org/viewcvs.cgi/modperl-2.0/xs/modperl_xs_util.h?r1=1.18&r2=1.19&diff_format=h
that added this cast was applied because on darwin you get 'incompatible pointer type' fixes without it. Go figure.
Anybody knows what's the deal here?
I forgot that SvPV is a macro too, and it turns its len argument into &len, hence the error. I'm not happy about introducing a temp variable and copy the values in a tight loop just because of some issue on netbsd. I'm trying to get hold of Ian Holsman (or anybody else on netbsd?) to find a more efficient solution.
Anyway, here is what (inefficient) I came up with so far to make all compilers happy:
/* XXX: both STRLEN and apr_size_t resolve to size_t, but some
* compilers (netbsd) still report incompatible pointer size and we
* can't use casting because other compilers (openbsd) complain too so
* resort to using a temp variable a do the casting outside the
* function call (note that SvPV is really turning its last argument
* into & via macros). the reason it's XXX is that I think we have a
* useless variable copying in a tight loop and losing CPU cycles
*/
#define mpxs_write_loop(func, obj) \
while (MARK <= SP) { \
apr_size_t wlen; \
STRLEN wlen1; \
apr_status_t rv; \
char *buf = SvPV(*MARK, wlen1); \
MP_TRACE_o(MP_FUNC, "%d bytes [%s]", wlen, buf); \
wlen = (apr_size_t)wlen1; \
rv = func(aTHX_ obj, buf, &wlen); \
if (rv != APR_SUCCESS) { \
Perl_croak(aTHX_ modperl_apr_strerror(rv)); \
} \
bytes += wlen; \
MARK++; \
}__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
