else
fp = PerlIO_open(name,mode);
}
- else if (name[len-1] == '|') {
+ else if (len > 1 && name[len-1] == '|') {
name[--len] = '\0';
while (len && isSPACE(name[len-1]))
name[--len] = '\0';
/* No SVs have survived, need to clean out */
linestr = NULL;
pidstatus = Nullhv;
- if (origfilename)
- Safefree(origfilename);
+ Safefree(origfilename);
+ Safefree(archpat_auto);
+ Safefree(reg_start_tmp);
+ Safefree(HeKEY_hek(&hv_fetch_ent_mh));
+ Safefree(op_mask);
nuke_stacks();
hints = 0; /* Reset hints. Should hints be per-interpreter ? */
curstackinfo = p;
}
Safefree(tmps_stack);
+ /* XXX refcount interpreters to determine when to free global data
+ Safefree(markstack);
+ Safefree(scopestack);
+ Safefree(savestack);
+ Safefree(retstack);
+ */
DEBUG( {
Safefree(debname);
Safefree(debdelim);
return;
if (addsubdirs) {
- subdir = NEWSV(55,0);
+ subdir = sv_newmortal();
if (!archpat_auto) {
STRLEN len = (sizeof(ARCHNAME) + strlen(patchlevel)
+ sizeof("//auto"));
/* finally push this lib directory on the end of @INC */
av_push(GvAVn(incgv), libdir);
}
-
- SvREFCNT_dec(subdir);
}
#ifdef USE_THREADS
} while (0)
static SV **registry;
-static I32 regsize;
+static I32 registry_size;
#define REGHASH(sv,size) ((((U32)(sv)) >> 2) % (size))
#define REG_REPLACE(sv,a,b) \
do { \
void* p = sv->sv_any; \
- I32 h = REGHASH(sv, regsize); \
+ I32 h = REGHASH(sv, registry_size); \
I32 i = h; \
while (registry[i] != (a)) { \
- if (++i >= regsize) \
+ if (++i >= registry_size) \
i = 0; \
if (i == h) \
die("SV registry bug"); \
reg_add(sv)
SV* sv;
{
- if (sv_count >= (regsize >> 1))
+ if (sv_count >= (registry_size >> 1))
{
SV **oldreg = registry;
- I32 oldsize = regsize;
+ I32 oldsize = registry_size;
- regsize = regsize ? ((regsize << 2) + 1) : 2037;
- Newz(707, registry, regsize, SV*);
+ registry_size = registry_size ? ((registry_size << 2) + 1) : 2037;
+ Newz(707, registry, registry_size, SV*);
if (oldreg) {
I32 i;
{
I32 i;
- for (i = 0; i < regsize; ++i) {
+ for (i = 0; i < registry_size; ++i) {
SV* sv = registry[i];
- if (sv)
+ if (sv && SvTYPE(sv) != SVTYPEMASK)
(*f)(sv);
}
}