summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.c17
-rw-r--r--op.c7
2 files changed, 12 insertions, 12 deletions
diff --git a/gv.c b/gv.c
index 3633e7bf62..11dc761e14 100644
--- a/gv.c
+++ b/gv.c
@@ -426,18 +426,17 @@ gv_fetchpv(char *nambeg, I32 add, I32 sv_type)
tmpbuf[len++] = ':';
tmpbuf[len] = '\0';
gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
+ gv = gvp ? *gvp : Nullgv;
+ if (gv && gv != (GV*)&sv_undef) {
+ if (SvTYPE(gv) != SVt_PVGV)
+ gv_init(gv, stash, tmpbuf, len, (add & 2));
+ else
+ GvMULTI_on(gv);
+ }
if (tmpbuf != autobuf)
Safefree(tmpbuf);
- if (!gvp || *gvp == (GV*)&sv_undef)
+ if (!gv || gv == (GV*)&sv_undef)
return Nullgv;
- gv = *gvp;
-
- if (SvTYPE(gv) == SVt_PVGV)
- GvMULTI_on(gv);
- else if (!add)
- return Nullgv;
- else
- gv_init(gv, stash, nambeg, namend - nambeg, (add & 2));
if (!(stash = GvHV(gv)))
stash = GvHV(gv) = newHV();
diff --git a/op.c b/op.c
index 5e2f5c2d17..c5c475a13a 100644
--- a/op.c
+++ b/op.c
@@ -4612,7 +4612,7 @@ ck_subr(OP *o)
kid->op_sibling = 0;
o2 = newUNOP(OP_RV2GV, 0, kid);
o2->op_sibling = sib;
- prev->op_sibling = o;
+ prev->op_sibling = o2;
}
goto wrapref;
case '\\':
@@ -4641,9 +4641,10 @@ ck_subr(OP *o)
wrapref:
{
OP* kid = o2;
- o2 = newUNOP(OP_REFGEN, 0, kid);
- o2->op_sibling = kid->op_sibling;
+ OP* sib = kid->op_sibling;
kid->op_sibling = 0;
+ o2 = newUNOP(OP_REFGEN, 0, kid);
+ o2->op_sibling = sib;
prev->op_sibling = o2;
}
break;