Skip to content

Commit c5aa55a

Browse files
committed
wip
1 parent dc41635 commit c5aa55a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pp_ctl.c

+9-2
Original file line numberDiff line numberDiff line change
@@ -3761,6 +3761,14 @@ S_require_file(pTHX_ SV *sv)
37613761
if (!(name && len > 0 && *name))
37623762
DIE(aTHX_ "Missing or undefined argument to %s", op_name);
37633763

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+
37643772
if (!IS_SAFE_PATHNAME(name, len, op_name)) {
37653773
if (!op_is_require) {
37663774
CLEAR_ERRSV();
@@ -3799,8 +3807,7 @@ S_require_file(pTHX_ SV *sv)
37993807
unixlen = len;
38003808
}
38013809
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);
38043811
if ( svp ) {
38053812
if (*svp != &PL_sv_undef)
38063813
RETPUSHYES;

0 commit comments

Comments
 (0)