We will now have to replace all wrappers like:
#define mp_xs_APR__Pool_2obj(ptr) \ sv_setref_pv(sv_newmortal(), "APR::Pool", (void*)ptr)
with an additional call to this macro
#define MP_CLONE_INSERT_OBJ(namespace, obj) \
{ \
SV *weak_rv, *sv_key; \
/* $objects{"$$self"} = $self; \
Scalar::Util::weaken($objects{"$$self"}) \
*/ \
HV *hv = get_hv(namespace MP_CLONE_HASH_NAME, TRUE); \
/* use the real object pointer as a unique key */ \
sv_key = newSVpvf("%p", MP_CLONE_KEY_COMMON(obj)); \
MP_CLONE_DEBUG_INSERT_KEY(namespace, obj); \
weak_rv = newRV(SvRV(obj)); \
WEAKEN(weak_rv); /* ala Scalar::Util::weaken */ \
{ \
HE *ok = hv_store_ent(hv, sv_key, weak_rv, FALSE); \
sv_free(sv_key); \
if (ok == NULL) { \
SvREFCNT_dec(weak_rv); \
Perl_croak(aTHX_ "failed to insert into %%%s", \
namespace MP_CLONE_HASH_NAME); \
} \
MP_CLONE_DUMP_OBJECTS_HASH(namespace); \
} \
}see the details in the previous email.
My problem is that I can't see how can I stick a call to MP_CLONE_INSERT_OBJ() inside the mp_xs_APR__Pool_2obj(ptr) wrapper. Since it's usually used as:
RETVAL = mp_xs_APR__Pool_2obj(ptr);
Is there some C trick to have multiple statements in the macro so it can be an rvalue? something like:
RETVAL = do { MP_CLONE_INSERT_OBJ(ptr); mp_xs_APR__Pool_2obj(ptr) };and have it working? If not than all the wrappers will need to become functions to be able to combine several statements and still return a single value.
I'm too tired to think... any ideas? Thanks!
-- __________________________________________________________________ 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]
