On 9/10/07, Florian Weimer <[EMAIL PROTECTED]> wrote:
> * Steve Fink:
>
> > I'm not saying that this is necessarily a good idea, but I became
> > similarly annoyed with some of the built-in typemaps. In my case, it
> > was AV* and HV*, which leak memory by default unless you do stuff that
> > is not needed with SV* returns. This is known, and documented, but
> > unfixable because of backwards compatibility.
>
> Could you post the snippet?  I'd like to use that as well.

OUTPUT
T_AVREF
        $arg = $var ? Perl_newRV(aTHX_ Perl_sv_2mortal(aTHX_ (SV *)
$var)) : &PL_sv_undef;
T_HVREF
        $arg = $var ? Perl_newRV(aTHX_ Perl_sv_2mortal(aTHX_ (SV *)
$var)) : &PL_sv_undef;

The default typemap is just '$arg = newRV((SV*)$var);'. So the
differences are an sv_2mortal and the same sort of NULL -> undef
mapping that you were talking about.

Reply via email to