Change 14395: coderefs in @INC and absolute paths
[email protected] (Chris Nandor) Wed, 23 Jan 2002 16:18:41 -0500
| Newsgroups | perl.perl5.changes.mac |
|---|---|
| Message-ID | <p05100306b874d92844c1@[10.0.1.177]> |
Change 14395 by pudge@pudge-mobile on 2002/01/23 20:01:43
coderefs in @INC and absolute paths
Affected files ...
.... //depot/maint-5.6/macperl/embed.h#2 edit
.... //depot/maint-5.6/macperl/pp_ctl.c#4 edit
.... //depot/maint-5.6/macperl/proto.h#2 edit
Differences ...
==== //depot/maint-5.6/macperl/embed.h#2 (text+w) ====
Index: perl/embed.h
--- perl/embed.h.~1~ Wed Jan 23 13:15:05 2002
+++ perl/embed.h Wed Jan 23 13:15:05 2002
@@ -975,6 +975,7 @@
#define save_lines S_save_lines
#define doeval S_doeval
#define doopen_pmc S_doopen_pmc
+#define path_is_absolute S_path_is_absolute
#define qsortsv S_qsortsv
#endif
#if defined(PERL_IN_PP_HOT_C) || defined(PERL_DECL_PROT)
@@ -2433,6 +2434,7 @@
#define save_lines(a,b) S_save_lines(aTHX_ a,b)
#define doeval(a,b) S_doeval(aTHX_ a,b)
#define doopen_pmc(a,b) S_doopen_pmc(aTHX_ a,b)
+#define path_is_absolute(a) S_path_is_absolute(aTHX_ a)
#define qsortsv(a,b,c) S_qsortsv(aTHX_ a,b,c)
#endif
#if defined(PERL_IN_PP_HOT_C) || defined(PERL_DECL_PROT)
==== //depot/maint-5.6/macperl/pp_ctl.c#4 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c.~1~ Wed Jan 23 13:15:05 2002
+++ perl/pp_ctl.c Wed Jan 23 13:15:05 2002
@@ -3028,30 +3028,11 @@
/* prepare to compile file */
-#ifdef MACOS_TRADITIONAL
- if (PERL_FILE_IS_ABSOLUTE(name)
- || (*name == ':' && name[1] != ':' && strchr(name+2, ':')))
- {
+ if (path_is_absolute(name)) {
tryname = name;
tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
- /* We consider paths of the form :a:b ambiguous and interpret them first
- as global then as local
- */
- if (!tryrsfp && *name == ':' && name[1] != ':' && strchr(name+2, ':'))
- goto trylocal;
}
- else
-trylocal: {
-#else
- if (PERL_FILE_IS_ABSOLUTE(name)
- || (*name == '.' && (name[1] == '/' ||
- (name[1] == '.' && name[2] == '/'))))
- {
- tryname = name;
- tryrsfp = doopen_pmc(name,PERL_SCRIPT_MODE);
- }
- else {
-#endif
+ if (!tryrsfp) {
AV *ar = GvAVn(PL_incgv);
I32 i;
#ifdef VMS
@@ -3171,6 +3152,14 @@
}
}
else {
+ if (!path_is_absolute(name)
+#ifdef MACOS_TRADITIONAL
+ /* We consider paths of the form :a:b ambiguous and interpret them first
+ as global then as local
+ */
+ || (*name == ':' && name[1] != ':' && strchr(name+2, ':'))
+#endif
+ ) {
char *dir = SvPVx(dirsv, n_a);
#ifdef MACOS_TRADITIONAL
char buf[256];
@@ -3202,6 +3191,7 @@
tryname += 2;
break;
}
+ }
}
}
}
@@ -4667,3 +4657,23 @@
}
#endif /* PERL_OBJECT */
+
+/* perhaps someone can come up with a better name for
+ this? it is not really "absolute", per se ... */
+static bool
+S_path_is_absolute(pTHX_ char *name)
+{
+ if (PERL_FILE_IS_ABSOLUTE(name)
+#ifdef MACOS_TRADITIONAL
+ || (*name == ':' && name[1] != ':' && strchr(name+2, ':')))
+#else
+ || (*name == '.' && (name[1] == '/' ||
+ (name[1] == '.' && name[2] == '/'))))
+#endif
+ {
+ return TRUE;
+ }
+ else
+ return FALSE;
+}
+
==== //depot/maint-5.6/macperl/proto.h#2 (text+w) ====
Index: perl/proto.h
--- perl/proto.h.~1~ Wed Jan 23 13:15:05 2002
+++ perl/proto.h Wed Jan 23 13:15:05 2002
@@ -1091,6 +1091,7 @@
STATIC void S_save_lines(pTHX_ AV *array, SV *sv);
STATIC OP* S_doeval(pTHX_ int gimme, OP** startop);
STATIC PerlIO * S_doopen_pmc(pTHX_ const char *name, const char *mode);
+STATIC bool S_path_is_absolute(pTHX_ char *name);
STATIC void S_qsortsv(pTHX_ SV ** array, size_t num_elts, SVCOMPARE_t f);
#endif
End of Patch.