/* not in cache, make a new one */
- retval = newAV();
- av_push(retval, newSVpvn(stashname, stashname_len)); /* us first */
-
gvp = (GV**)hv_fetchs(stash, "ISA", FALSE);
isa = (gvp && (gv = *gvp) && isGV_with_GP(gv)) ? GvAV(gv) : NULL;
else {
isa_lin = mro_get_linear_isa_c3(isa_item_stash, level + 1); /* recursion */
}
- av_push(seqs, (SV*)isa_lin);
+ av_push(seqs, SvREFCNT_inc_simple_NN((SV*)isa_lin));
}
- av_push(seqs, (SV*)isa);
+ av_push(seqs, SvREFCNT_inc_simple_NN((SV*)isa));
/* This builds "heads", which as an array of integer array
indices, one per seq, which point at the virtual "head"
}
}
+ /* Initialize retval to build the return value in */
+ retval = newAV();
+ av_push(retval, newSVpvn(stashname, stashname_len)); /* us first */
+
/* This loop won't terminate until we either finish building
the MRO, or get an exception. */
while(1) {
const int new_head = ++heads[s];
if(new_head > AvFILLp(seq)) {
+ SvREFCNT_dec(avptr[s]);
avptr[s] = NULL;
}
else {
hierarchy is not C3-incompatible */
if(!winner) {
/* we have to do some cleanup before we croak */
- SV** svp = AvARRAY(seqs);
- items = AvFILLp(seqs) + 1;
- while (items--)
- *svp++ = NULL;
SvREFCNT_dec(retval);
Safefree(heads);
}
}
}
+ else { /* @ISA was undefined or empty */
+ /* build a retval containing only ourselves */
+ retval = newAV();
+ av_push(retval, newSVpvn(stashname, stashname_len));
+ }
/* we don't want anyone modifying the cache entry but us,
and we do so by replacing it completely */