This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In S_check_type_and_open() call PerlIO_openn() directly if possible.
authorNicholas Clark <nick@ccl4.org>
Tue, 9 Nov 2010 15:58:52 +0000 (15:58 +0000)
committerNicholas Clark <nick@ccl4.org>
Tue, 9 Nov 2010 16:19:14 +0000 (16:19 +0000)
This saves creating a mortal SV on every file require (and a strlen()).

This commit brought to you with the aid of the campaign for elimination of
strlen().

pp_ctl.c

index 343c079..7218e5c 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3343,7 +3343,11 @@ S_check_type_and_open(pTHX_ SV *name)
        return NULL;
     }
 
+#if !defined(PERLIO_IS_STDIO) && !defined(USE_SFIO)
+    return PerlIO_openn(aTHX_ NULL, PERL_SCRIPT_MODE, -1, 0, 0, NULL, 1, &name);
+#else
     return PerlIO_open(p, PERL_SCRIPT_MODE);
+#endif
 }
 
 #ifndef PERL_DISABLE_PMC