call_method() uses newSVpvn_flags(), instead of sv_2mortal(newSVpv(...)), because...
gfx [Sat, 5 Sep 2009 07:46:34 +0000 (16:46 +0900)]
Signed-off-by: Yves Orton <demerphq@gemini.(none)>

perl.c

diff --git a/perl.c b/perl.c
index 126de99..3c80c97 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2485,9 +2485,13 @@ Perl_call_method(pTHX_ const char *methname, I32 flags)
                                /* name of the subroutine */
                        /* See G_* flags in cop.h */
 {
+    STRLEN len;
     PERL_ARGS_ASSERT_CALL_METHOD;
 
-    return call_sv(sv_2mortal(newSVpv(methname,0)), flags | G_METHOD);
+    len = strlen(methname);
+
+    /* XXX: sv_2mortal(newSVpvn_share(methname, len)) can be faster */
+    return call_sv(newSVpvn_flags(methname, len, SVs_TEMP), flags | G_METHOD);
 }
 
 /* May be called with any of a CV, a GV, or an SV containing the name. */