This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In S_magic_methcall1(), tweak the initialisation of arg1 to reduce code size.
authorNicholas Clark <nick@ccl4.org>
Sun, 25 Apr 2010 08:23:25 +0000 (09:23 +0100)
committerNicholas Clark <nick@ccl4.org>
Sun, 25 Apr 2010 08:23:25 +0000 (09:23 +0100)
mg.c

diff --git a/mg.c b/mg.c
index 24d2b98..b6bd297 100644 (file)
--- a/mg.c
+++ b/mg.c
@@ -1718,15 +1718,13 @@ S_magic_methcall1(pTHX_ SV *sv, const MAGIC *mg, const char *meth, I32 flags,
 
     if (mg->mg_ptr) {
        if (mg->mg_len >= 0) {
-           arg1 = newSVpvn(mg->mg_ptr, mg->mg_len);
-           sv_2mortal(arg1);
+           arg1 = newSVpvn_flags(mg->mg_ptr, mg->mg_len, SVs_TEMP);
        }
        else if (mg->mg_len == HEf_SVKEY)
            arg1 = MUTABLE_SV(mg->mg_ptr);
     }
     else if (mg->mg_type == PERL_MAGIC_tiedelem) {
-       arg1 = newSV_type(SVt_IV);
-       sv_setiv(arg1, (IV)(mg->mg_len));
+       arg1 = newSViv((IV)(mg->mg_len));
        sv_2mortal(arg1);
     }
     if (!arg1) {