summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--av.c3
-rw-r--r--hv.c62
-rw-r--r--objpp.h2
-rw-r--r--patchlevel.h2
-rw-r--r--pp_ctl.c19
-rw-r--r--pp_hot.c8
-rw-r--r--proto.h2
-rw-r--r--regexec.c2
-rw-r--r--regexp.h8
-rw-r--r--toke.c2
-rw-r--r--win32/perlhost.h19
-rw-r--r--win32/win32.c12
12 files changed, 67 insertions, 74 deletions
diff --git a/av.c b/av.c
index 2e460536ed..b69dcf2a45 100644
--- a/av.c
+++ b/av.c
@@ -596,7 +596,7 @@ av_fill(register AV *av, I32 fill)
* hash keys to array indices.
*/
-static I32
+STATIC I32
avhv_index_sv(SV* sv)
{
I32 index = SvIV(sv);
@@ -620,6 +620,7 @@ avhv_keys(AV *av)
}
}
croak("Can't coerce array into hash");
+ return Nullhv;
}
SV**
diff --git a/hv.c b/hv.c
index 918640eef7..4f5642f3c3 100644
--- a/hv.c
+++ b/hv.c
@@ -299,7 +299,7 @@ hv_store(HV *hv, char *key, U32 klen, SV *val, register U32 hash)
PERL_HASH(hash, key, klen);
if (!xhv->xhv_array)
- Newz(505, xhv->xhv_array, sizeof(HE**) * (xhv->xhv_max + 1), char);
+ Newz(505, xhv->xhv_array, sizeof(HE*) * (xhv->xhv_max + 1), char);
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
i = 1;
@@ -380,7 +380,7 @@ hv_store_ent(HV *hv, SV *keysv, SV *val, register U32 hash)
PERL_HASH(hash, key, klen);
if (!xhv->xhv_array)
- Newz(505, xhv->xhv_array, sizeof(HE**) * (xhv->xhv_max + 1), char);
+ Newz(505, xhv->xhv_array, sizeof(HE*) * (xhv->xhv_max + 1), char);
oentry = &((HE**)xhv->xhv_array)[hash & (I32) xhv->xhv_max];
i = 1;
@@ -665,14 +665,15 @@ hsplit(HV *hv)
I32 oldsize = (I32) xhv->xhv_max + 1; /* sic(k) */
register I32 newsize = oldsize * 2;
register I32 i;
- register HE **a = (HE**)xhv->xhv_array;
- register HE **b;
+ register char *a = xhv->xhv_array;
+ register HE **aep;
+ register HE **bep;
register HE *entry;
register HE **oentry;
nomemok = TRUE;
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
- Renew(a, newsize, HE*);
+ Renew(a, newsize * sizeof(HE*), char);
if (!a) {
nomemok = FALSE;
return;
@@ -684,7 +685,7 @@ hsplit(HV *hv)
nomemok = FALSE;
return;
}
- Copy(xhv->xhv_array, a, oldsize, HE*);
+ Copy(xhv->xhv_array, a, oldsize * sizeof(HE*), char);
if (oldsize >= 64) {
offer_nice_chunk(xhv->xhv_array,
oldsize * sizeof(HE*) * 2 - MALLOC_OVERHEAD);
@@ -694,27 +695,28 @@ hsplit(HV *hv)
#endif
nomemok = FALSE;
- Zero(&a[oldsize], oldsize, HE*); /* zero 2nd half*/
+ Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/
xhv->xhv_max = --newsize;
- xhv->xhv_array = (char*)a;
+ xhv->xhv_array = a;
+ aep = (HE**)a;
- for (i=0; i<oldsize; i++,a++) {
- if (!*a) /* non-existent */
+ for (i=0; i<oldsize; i++,aep++) {
+ if (!*aep) /* non-existent */
continue;
- b = a+oldsize;
- for (oentry = a, entry = *a; entry; entry = *oentry) {
+ bep = aep+oldsize;
+ for (oentry = aep, entry = *aep; entry; entry = *oentry) {
if ((HeHASH(entry) & newsize) != i) {
*oentry = HeNEXT(entry);
- HeNEXT(entry) = *b;
- if (!*b)
+ HeNEXT(entry) = *bep;
+ if (!*bep)
xhv->xhv_fill++;
- *b = entry;
+ *bep = entry;
continue;
}
else
oentry = &HeNEXT(entry);
}
- if (!*a) /* everything moved */
+ if (!*aep) /* everything moved */
xhv->xhv_fill--;
}
}
@@ -727,7 +729,8 @@ hv_ksplit(HV *hv, IV newmax)
register I32 newsize;
register I32 i;
register I32 j;
- register HE **a;
+ register char *a;
+ register HE **aep;
register HE *entry;
register HE **oentry;
@@ -742,11 +745,11 @@ hv_ksplit(HV *hv, IV newmax)
if (newsize < newmax)
return; /* overflow detection */
- a = (HE**)xhv->xhv_array;
+ a = xhv->xhv_array;
if (a) {
nomemok = TRUE;
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
- Renew(a, newsize, HE*);
+ Renew(a, newsize * sizeof(HE*), char);
if (!a) {
nomemok = FALSE;
return;
@@ -757,7 +760,7 @@ hv_ksplit(HV *hv, IV newmax)
nomemok = FALSE;
return;
}
- Copy(xhv->xhv_array, a, oldsize, HE*);
+ Copy(xhv->xhv_array, a, oldsize * sizeof(HE*), char);
if (oldsize >= 64) {
offer_nice_chunk(xhv->xhv_array,
oldsize * sizeof(HE*) * 2 - MALLOC_OVERHEAD);
@@ -766,36 +769,37 @@ hv_ksplit(HV *hv, IV newmax)
Safefree(xhv->xhv_array);
#endif
nomemok = FALSE;
- Zero(&a[oldsize], newsize-oldsize, HE*); /* zero 2nd half*/
+ Zero(&a[oldsize * sizeof(HE*)], (newsize-oldsize) * sizeof(HE*), char); /* zero 2nd half*/
}
else {
#if defined(STRANGE_MALLOC) || defined(MYMALLOC)
- Newz(0, a, newsize, HE*);
+ Newz(0, a, newsize * sizeof(HE*), char);
#else
Newz(0, a, newsize * sizeof(HE*) * 2 - MALLOC_OVERHEAD, char);
#endif
}
xhv->xhv_max = --newsize;
- xhv->xhv_array = (char*)a;
+ xhv->xhv_array = a;
if (!xhv->xhv_fill) /* skip rest if no entries */
return;
- for (i=0; i<oldsize; i++,a++) {
- if (!*a) /* non-existent */
+ aep = (HE**)a;
+ for (i=0; i<oldsize; i++,aep++) {
+ if (!*aep) /* non-existent */
continue;
- for (oentry = a, entry = *a; entry; entry = *oentry) {
+ for (oentry = aep, entry = *aep; entry; entry = *oentry) {
if ((j = (HeHASH(entry) & newsize)) != i) {
j -= i;
*oentry = HeNEXT(entry);
- if (!(HeNEXT(entry) = a[j]))
+ if (!(HeNEXT(entry) = aep[j]))
xhv->xhv_fill++;
- a[j] = entry;
+ aep[j] = entry;
continue;
}
else
oentry = &HeNEXT(entry);
}
- if (!*a) /* everything moved */
+ if (!*aep) /* everything moved */
xhv->xhv_fill--;
}
}
diff --git a/objpp.h b/objpp.h
index ba12c25760..469fefcc9f 100644
--- a/objpp.h
+++ b/objpp.h
@@ -55,6 +55,8 @@
#define avhv_fetch_ent CPerlObj::Perl_avhv_fetch_ent
#undef avhv_exists_ent
#define avhv_exists_ent CPerlObj::Perl_avhv_exists_ent
+#undef avhv_index_sv
+#define avhv_index_sv CPerlObj::avhv_index_sv
#undef avhv_iternext
#define avhv_iternext CPerlObj::Perl_avhv_iternext
#undef avhv_iterval
diff --git a/patchlevel.h b/patchlevel.h
index a61ebda4a1..de4e8f579b 100644
--- a/patchlevel.h
+++ b/patchlevel.h
@@ -1,6 +1,6 @@
#ifndef __PATCHLEVEL_H_INCLUDED__
#define PATCHLEVEL 4
-#define SUBVERSION 69
+#define SUBVERSION 70
/*
local_patches -- list of locally applied less-than-subversion patches.
diff --git a/pp_ctl.c b/pp_ctl.c
index f121b7e453..96e852e50a 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -90,15 +90,6 @@ PP(pp_regcomp)
else {
t = SvPV(tmpstr, len);
-#ifndef INCOMPLETE_TAINTS
- if (tainting) {
- if (tainted)
- pm->op_pmdynflags |= PMdf_TAINTED;
- else
- pm->op_pmdynflags &= ~PMdf_TAINTED;
- }
-#endif
-
/* Check against the last compiled regexp. */
if (!pm->op_pmregexp || !pm->op_pmregexp->precomp ||
pm->op_pmregexp->prelen != len ||
@@ -114,6 +105,15 @@ PP(pp_regcomp)
}
}
+#ifndef INCOMPLETE_TAINTS
+ if (tainting) {
+ if (tainted)
+ pm->op_pmdynflags |= PMdf_TAINTED;
+ else
+ pm->op_pmdynflags &= ~PMdf_TAINTED;
+ }
+#endif
+
if (!pm->op_pmregexp->prelen && curpm)
pm = curpm;
else if (strEQ("\\s+", pm->op_pmregexp->precomp))
@@ -155,7 +155,6 @@ PP(pp_substcont)
SV *targ = cx->sb_targ;
sv_catpvn(dstr, s, cx->sb_strend - s);
- TAINT_IF(cx->sb_rxtainted || RX_MATCH_TAINTED(rx));
cx->sb_rxtainted |= RX_MATCH_TAINTED(rx);
(void)SvOOK_off(targ);
diff --git a/pp_hot.c b/pp_hot.c
index da2a41fe6f..8e3bf706da 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -917,7 +917,9 @@ play_it_again:
/*NOTREACHED*/
gotcha:
- RX_MATCH_TAINTED_SET(rx, rxtainted);
+ if (rxtainted)
+ RX_MATCH_TAINTED_on(rx);
+ TAINT_IF(RX_MATCH_TAINTED(rx));
if (gimme == G_ARRAY) {
I32 iters, i, len;
@@ -970,7 +972,9 @@ play_it_again:
}
yup: /* Confirmed by check_substr */
- RX_MATCH_TAINTED_SET(rx, rxtainted);
+ if (rxtainted)
+ RX_MATCH_TAINTED_on(rx);
+ TAINT_IF(RX_MATCH_TAINTED(rx));
++BmUSEFUL(rx->check_substr);
curpm = pm;
if (pm->op_pmflags & PMf_ONCE)
diff --git a/proto.h b/proto.h
index 0da072ed72..a74dc60b78 100644
--- a/proto.h
+++ b/proto.h
@@ -660,7 +660,7 @@ void del_xrv _((XRV* p));
void sv_mortalgrow _((void));
void sv_unglob _((SV* sv));
void sv_check_thinkfirst _((SV *sv));
-
+I32 avhv_index_sv _((SV* sv));
void sv_catpv_mg _((SV *sv, char *ptr));
void sv_catpvf_mg _((SV *sv, const char* pat, ...));
diff --git a/regexec.c b/regexec.c
index d5d94612b7..6efc93ce77 100644
--- a/regexec.c
+++ b/regexec.c
@@ -610,7 +610,7 @@ got_it:
strend += dontbother; /* uncheat */
prog->subbeg = strbeg;
prog->subend = strend;
- RX_MATCH_TAINTED_SET(prog, reg_flags & RF_tainted);
+ RX_MATCH_TAINTED_set(prog, reg_flags & RF_tainted);
/* make sure $`, $&, $', and $digit will work later */
if (strbeg != prog->subbase) { /* second+ //g match. */
diff --git a/regexp.h b/regexp.h
index f1301d9102..a123efe02f 100644
--- a/regexp.h
+++ b/regexp.h
@@ -90,9 +90,11 @@ typedef struct regexp {
#define ROPT_TAINTED_SEEN 0x8000
#define RX_MATCH_TAINTED(prog) ((prog)->reganch & ROPT_TAINTED_SEEN)
-#define RX_MATCH_TAINTED_SET(prog, t) ((t) \
- ? ((prog)->reganch |= ROPT_TAINTED_SEEN) \
- : ((prog)->reganch &= ~ROPT_TAINTED_SEEN))
+#define RX_MATCH_TAINTED_on(prog) ((prog)->reganch |= ROPT_TAINTED_SEEN)
+#define RX_MATCH_TAINTED_off(prog) ((prog)->reganch &= ~ROPT_TAINTED_SEEN)
+#define RX_MATCH_TAINTED_set(prog, t) ((t) \
+ ? RX_MATCH_TAINTED_on(prog) \
+ : RX_MATCH_TAINTED_off(prog))
#define REXEC_COPY_STR 1 /* Need to copy the string. */
#define REXEC_CHECKED 2 /* check_substr already checked. */
diff --git a/toke.c b/toke.c
index 27571e4a86..65480b4f19 100644
--- a/toke.c
+++ b/toke.c
@@ -4399,7 +4399,7 @@ keyword(register char *d, I32 len)
case 3:
if (strEQ(d,"ord")) return -KEY_ord;
if (strEQ(d,"oct")) return -KEY_oct;
- if (strEQ(d,"our")) { deprecate("reserved keyword \"our\"");
+ if (strEQ(d,"our")) { deprecate("reserved word \"our\"");
return 0;}
break;
case 4:
diff --git a/win32/perlhost.h b/win32/perlhost.h
index a4c2e3ce51..10abef93dc 100644
--- a/win32/perlhost.h
+++ b/win32/perlhost.h
@@ -32,13 +32,6 @@ extern CPerlObj *pPerl;
err = errno;\
return ret;
-extern int g_closedir(DIR *dirp);
-extern DIR * g_opendir(char *filename);
-extern struct direct * g_readdir(DIR *dirp);
-extern void g_rewinddir(DIR *dirp);
-extern void g_seekdir(DIR *dirp, long loc);
-extern long g_telldir(DIR *dirp);
-
class CPerlDir : public IPerlDir
{
public:
@@ -57,27 +50,27 @@ public:
};
virtual int Close(DIR *dirp, int &err)
{
- return g_closedir(dirp);
+ return win32_closedir(dirp);
};
virtual DIR *Open(char *filename, int &err)
{
- return g_opendir(filename);
+ return win32_opendir(filename);
};
virtual struct direct *Read(DIR *dirp, int &err)
{
- return g_readdir(dirp);
+ return win32_readdir(dirp);
};
virtual void Rewind(DIR *dirp, int &err)
{
- g_rewinddir(dirp);
+ win32_rewinddir(dirp);
};
virtual void Seek(DIR *dirp, long loc, int &err)
{
- g_seekdir(dirp, loc);
+ win32_seekdir(dirp, loc);
};
virtual long Tell(DIR *dirp, int &err)
{
- return g_telldir(dirp);
+ return win32_telldir(dirp);
};
};
diff --git a/win32/win32.c b/win32/win32.c
index 03552debbf..ef59a8f2ab 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -87,18 +87,6 @@ int _CRT_glob = 0;
#define do_spawn g_do_spawn
#undef do_exec
#define do_exec g_do_exec
-#undef opendir
-#define opendir g_opendir
-#undef readdir
-#define readdir g_readdir
-#undef telldir
-#define telldir g_telldir
-#undef seekdir
-#define seekdir g_seekdir
-#undef rewinddir
-#define rewinddir g_rewinddir
-#undef closedir
-#define closedir g_closedir
#undef getlogin
#define getlogin g_getlogin
#endif