summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorPerl 5 Porters <perl5-porters@africa.nicoh.com>1997-04-03 10:03:25 +1200
committerChip Salzenberg <chip@atlantic.net>1997-04-03 10:03:25 +1200
commit5aabfad66ac77650f584e2f07af91645e19fe296 (patch)
treeac96571984ba780e9ae7736cfe85dd17f6cfd865 /mg.c
parent4a6725af9146bd7faaa10aa5429ff009d393fd6d (diff)
downloadperl-5aabfad66ac77650f584e2f07af91645e19fe296.tar.gz
[inseparable changes from match from perl-5.003_97 to perl-5.003_97a]
CORE PORTABILITY Subject: Add support for Cygwin32 (GNU-Win32) -- very low impact Date: Thu, 3 Apr 1997 09:21:17 +0100 From: John Cerney <j-cerney1@ti.com> Files: MANIFEST README.cygwin32 cygwin32/cw32imp.h cygwin32/gcc2 cygwin32/ld2 cygwin32/perlgcc cygwin32/perlld ext/DynaLoader/dl_cygwin32.xs hints/cygwin32.sh perl.h pp_sys.c Msg-ID: 199704030821.JAA08762@pluto.tiuk.ti.com (applied based on p5p patch as commit 2a079e0090406b1b2e50643540f149206c9e9de8) Subject: Win32 update (six patches) From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: MANIFEST README.win32 dosish.h t/io/fs.t t/io/tell.t t/lib/io_tell.t t/op/magic.t t/op/mkdir.t t/op/runlevel.t t/op/stat.t t/op/taint.t win32/Makefile win32/VC-2.0/pod.mak win32/makedef.pl win32/pod.mak win32/win32.c win32/win32.h win32/win32io.c win32/win32io.h win32/win32iop.h LIBRARY AND EXTENSIONS Subject: Math::Trig, based on (and from an author of) Math::Complex From: Chip Salzenberg <chip@perl.com> Files: MANIFEST lib/Math/Complex.pm lib/Math/Trig.pm pod/perldelta.pod t/lib/complex.t t/lib/trig.t OTHER CORE CHANGES Subject: Fix const-sub-related panic on C<sub foo { my $x; 0 } foo> From: Chip Salzenberg <chip@perl.com> Files: op.c Subject: Fix warning for useless C<1..2> From: Chip Salzenberg <chip@perl.com> Files: op.c Subject: Minor cleanups Date: Thu, 03 Apr 1997 19:56:57 -0500 From: Gurusamy Sarathy <gsar@engin.umich.edu> Files: mg.c mg.h perl.c Msg-ID: 199704040056.TAA22253@aatma.engin.umich.edu (applied based on p5p patch as commit 609794497049cf42bdd2396c04cbb7728e10374d) Subject: Eliminate unreliable warning with %SIG and strict refs From: Chip Salzenberg <chip@perl.com> Files: mg.c Subject: Fix impossible test in vivification From: Chip Salzenberg <chip@perl.com> Files: mg.c
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/mg.c b/mg.c
index 5b25c40d0c..f1dc828029 100644
--- a/mg.c
+++ b/mg.c
@@ -581,27 +581,20 @@ MAGIC* mg;
{
register char *s;
char *ptr;
- STRLEN len;
+ STRLEN len, klen;
I32 i;
s = SvPV(sv,len);
- ptr = MgPV(mg);
+ ptr = MgPV(mg,klen);
my_setenv(ptr, s);
#ifdef DYNAMIC_ENV_FETCH
/* We just undefd an environment var. Is a replacement */
/* waiting in the wings? */
if (!len) {
- HE *envhe;
- SV *keysv;
- if (mg->mg_len == HEf_SVKEY)
- keysv = (SV *)mg->mg_ptr;
- else
- keysv = newSVpv(mg->mg_ptr, mg->mg_len);
- if ((envhe = hv_fetch_ent(GvHVn(envgv), keysv, FALSE, 0)))
- s = SvPV(HeVAL(envhe), len);
- if (mg->mg_len != HEf_SVKEY)
- SvREFCNT_dec(keysv);
+ SV **valp;
+ if ((valp = hv_fetch(GvHVn(envgv), ptr, klen, FALSE)))
+ s = SvPV(*valp, len);
}
#endif
@@ -611,7 +604,7 @@ MAGIC* mg;
if (tainting) {
MgTAINTEDDIR_off(mg);
#ifdef VMS
- if (s && strnEQ(ptr, "DCL$PATH", 8)) {
+ if (s && klen == 8 && strEQ(ptr, "DCL$PATH")) {
char pathbuf[256], eltbuf[256], *cp, *elt = s;
struct stat sbuf;
int i = 0, j = 0;
@@ -636,7 +629,7 @@ MAGIC* mg;
} while (my_trnlnm(s, pathbuf, i++) && (elt = pathbuf));
}
#endif /* VMS */
- if (s && strEQ(ptr,"PATH")) {
+ if (s && klen == 4 && strEQ(ptr,"PATH")) {
char *strend = s + len;
while (s < strend) {
@@ -661,7 +654,7 @@ magic_clearenv(sv,mg)
SV* sv;
MAGIC* mg;
{
- my_setenv(MgPV(mg),Nullch);
+ my_setenv(MgPV(mg,na),Nullch);
return 0;
}
@@ -672,7 +665,7 @@ MAGIC* mg;
{
I32 i;
/* Are we fetching a signal entry? */
- i = whichsig(MgPV(mg));
+ i = whichsig(MgPV(mg,na));
if (i) {
if(psig_ptr[i])
sv_setsv(sv,psig_ptr[i]);
@@ -697,7 +690,7 @@ MAGIC* mg;
{
I32 i;
/* Are we clearing a signal entry? */
- i = whichsig(MgPV(mg));
+ i = whichsig(MgPV(mg,na));
if (i) {
if(psig_ptr[i]) {
SvREFCNT_dec(psig_ptr[i]);
@@ -720,7 +713,7 @@ MAGIC* mg;
I32 i;
SV** svp;
- s = MgPV(mg);
+ s = MgPV(mg,na);
if (*s == '_') {
if (strEQ(s,"__DIE__"))
svp = &diehook;
@@ -771,8 +764,11 @@ MAGIC* mg;
*svp = 0;
}
else {
- if(hints & HINT_STRICT_REFS)
- die(no_symref,s,"a subroutine");
+ /*
+ * We should warn if HINT_STRICT_REFS, but without
+ * access to a known hint bit in a known OP, we can't
+ * tell whether HINT_STRICT_REFS is in force or not.
+ */
if (!strchr(s,':') && !strchr(s,'\'')) {
sprintf(tokenbuf, "main::%s",s);
sv_setpv(sv,tokenbuf);
@@ -958,7 +954,7 @@ MAGIC* mg;
gv = DBline;
i = SvTRUE(sv);
svp = av_fetch(GvAV(gv),
- atoi(MgPV(mg)), FALSE);
+ atoi(MgPV(mg,na)), FALSE);
if (svp && SvIOKp(*svp) && (o = (OP*)SvSTASH(*svp)))
o->op_private = i;
else
@@ -1200,7 +1196,7 @@ SV* sv;
}
else {
AV* av = (AV*)LvTARG(sv);
- if (LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av))
+ if ((I32)LvTARGLEN(sv) < 0 && (I32)LvTARGOFF(sv) > AvFILL(av))
LvTARG(sv) = Nullsv; /* array can't be extended */
else {
SV** svp = av_fetch(av, LvTARGOFF(sv), TRUE);