This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
A terser way of implementing require_pv.
authorNicholas Clark <nick@ccl4.org>
Thu, 30 Jun 2005 17:28:45 +0000 (17:28 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 30 Jun 2005 17:28:45 +0000 (17:28 +0000)
p4raw-id: //depot/perl@25029

perl.c

diff --git a/perl.c b/perl.c
index 57a9471..5d5ec62 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -2719,11 +2719,8 @@ Perl_require_pv(pTHX_ const char *pv)
     dSP;
     PUSHSTACKi(PERLSI_REQUIRE);
     PUTBACK;
-    sv = sv_newmortal();
-    sv_setpv(sv, "require '");
-    sv_catpv(sv, pv);
-    sv_catpv(sv, "'");
-    eval_sv(sv, G_DISCARD);
+    sv = Perl_newSVpvf(aTHX_ "require q%c%s%c", 0, pv, 0);
+    eval_sv(sv_2mortal(sv), G_DISCARD);
     SPAGAIN;
     POPSTACK;
 }