File tree 1 file changed +9
-2
lines changed
1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -3761,6 +3761,14 @@ S_require_file(pTHX_ SV *sv)
3761
3761
if (!(name && len > 0 && * name ))
3762
3762
DIE (aTHX_ "Missing or undefined argument to %s" , op_name );
3763
3763
3764
+ /* FIXME should be only ifndef VMS */
3765
+ /* try to return earlier if INC already got the name */
3766
+ if (op_is_require ) {
3767
+ /* can optimize to only perform one single lookup */
3768
+ SV * const * const svp = hv_fetch (GvHVn (PL_incgv ), (char * ) name , len , 0 );
3769
+ if ( svp && * svp != & PL_sv_undef ) RETPUSHYES ;
3770
+ }
3771
+
3764
3772
if (!IS_SAFE_PATHNAME (name , len , op_name )) {
3765
3773
if (!op_is_require ) {
3766
3774
CLEAR_ERRSV ();
@@ -3799,8 +3807,7 @@ S_require_file(pTHX_ SV *sv)
3799
3807
unixlen = len ;
3800
3808
}
3801
3809
if (op_is_require ) {
3802
- SV * const * const svp = hv_fetch (GvHVn (PL_incgv ),
3803
- unixname , unixlen , 0 );
3810
+ SV * const * const svp = hv_fetch (GvHVn (PL_incgv ), unixname , unixlen , 0 );
3804
3811
if ( svp ) {
3805
3812
if (* svp != & PL_sv_undef )
3806
3813
RETPUSHYES ;
You can’t perform that action at this time.
0 commit comments