Stas Bekman <[EMAIL PROTECTED]> writes:
[...]
As most of the time internal mp magic doesn't use the mg_obj slot, I'm
trying to just to hang the pool object there. that will solve the problem of
double magic
+1- I used that fact in certain places within apreq2 to avoid it, so I think it can work.
Yes, it seems to work fine.
(I still can't figure how using perl public API one finds more than one magic of the same type)
You can't use mg_find, but you could walk the SvMAGIC linked-list manually (it's a public struct). I think people used mg_ptr as a tag string to differentiate different ext-magics, but I have not actually seen it done in practice.
Manipulating internal structs manually sounds scary, but it's not the first time modperl does something like that. I just hoped that mg_find could be used to some iterate over magic chain.
and will save some memory too.
#define mpxs_add_pool_magic(obj, pool_obj) \ if (mpxs_pool_is_custom(SvRV(pool_obj))) { \ MAGIC *mg = mg_find(SvRV(obj), PERL_MAGIC_ext); \ if (mg) { \ if (mg->mg_obj == Nullsv) { \ mg->mg_obj = SvREFCNT_inc(pool_obj); \ mg->mg_flags |= MGf_REFCOUNTED; \ } \ else { \ Perl_croak(aTHX_ "Fixme: don't know how to " \ "handle non-Nullsv magic"); \ } \ } \ else { \ mpxs_add_pool_magic_doit(obj, pool_obj); \ } \ }
Looks good!
there was a buglet in it but now fixed.
I still have a problem with APR::Pool->new->new, trying to figure out how to hang APR::Pool magic on APR::Pool objects themselves. At the moment things crash badly, after mg_free call.
The only other remaining problem is the one with $bucket->setaside($pool) which I think has an implementation problem:
http://marc.theaimsgroup.com/?l=apache-modperl-dev&m=110391757729115&w=2
I'd like to hear your thoughts on that one, Joe.
-- __________________________________________________________________ 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]
