This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Using gv_stashsv() and sv_setsv() in Perl_package reduces source and
authorNicholas Clark <nick@ccl4.org>
Sat, 27 Jan 2007 12:55:31 +0000 (12:55 +0000)
committerNicholas Clark <nick@ccl4.org>
Sat, 27 Jan 2007 12:55:31 +0000 (12:55 +0000)
object code size.

p4raw-id: //depot/perl@30028

op.c

diff --git a/op.c b/op.c
index 5d78580..14f1a7d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3482,8 +3482,7 @@ void
 Perl_package(pTHX_ OP *o)
 {
     dVAR;
-    const char *name;
-    STRLEN len;
+    SV *const sv = cSVOPo->op_sv;
 #ifdef PERL_MAD
     OP *pegop;
 #endif
@@ -3491,9 +3490,8 @@ Perl_package(pTHX_ OP *o)
     save_hptr(&PL_curstash);
     save_item(PL_curstname);
 
-    name = SvPV_const(cSVOPo->op_sv, len);
-    PL_curstash = gv_stashpvn(name, len, GV_ADD);
-    sv_setpvn(PL_curstname, name, len);
+    PL_curstash = gv_stashsv(sv, GV_ADD);
+    sv_setsv(PL_curstname, sv);
 
     PL_hints |= HINT_BLOCK_SCOPE;
     PL_copline = NOLINE;