name is only set when there is no gv. As of a couple of commits ago,
tmpsv is only used in that else block where it is set.
dSP;
int fd;
GV *gv;
- SV *tmpsv = NULL;
char *name = NULL;
STRLEN namelen;
if (PL_op->op_flags & OPf_REF)
gv = cGVOP_gv;
else {
- tmpsv = POPs;
+ SV *tmpsv = POPs;
if (!(gv = MAYBE_DEREF_GV_nomg(tmpsv))) {
name = SvPV_nomg(tmpsv, namelen);
gv = gv_fetchpvn_flags(name, namelen, SvUTF8(tmpsv), SVt_PVIO);
if (GvIO(gv) && IoIFP(GvIOp(gv)))
fd = PerlIO_fileno(IoIFP(GvIOp(gv)));
- else if (!gv && SvOK(tmpsv)) {
- if (isDIGIT(*name))
+ else if (name && isDIGIT(*name))
fd = atoi(name);
- else
- RETPUSHUNDEF;
- }
else
RETPUSHUNDEF;
if (PerlLIO_isatty(fd))