* hash keys to array indices.
*/
-static I32
+STATIC I32
avhv_index_sv(SV* sv)
{
I32 index = SvIV(sv);
}
}
croak("Can't coerce array into hash");
+ return Nullhv;
}
SV**
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;
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;
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;
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);
#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--;
}
}
register I32 newsize;
register I32 i;
register I32 j;
- register HE **a;
+ register char *a;
+ register HE **aep;
register HE *entry;
register HE **oentry;
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;
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);
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--;
}
}
#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
#ifndef __PATCHLEVEL_H_INCLUDED__
#define PATCHLEVEL 4
-#define SUBVERSION 69
+#define SUBVERSION 70
/*
local_patches -- list of locally applied less-than-subversion patches.
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 ||
}
}
+#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))
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);
/*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;
}
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)
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, ...));
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. */
#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. */
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:
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:
};
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);
};
};
#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