summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2005-01-07 12:46:07 +0000
committerNicholas Clark <nick@ccl4.org>2005-01-07 12:46:07 +0000
commit7a5fd60d4ce737f71e7a689eaa2061a36dd225dc (patch)
tree183a110209d7b6c885b4a544840990eed5ece802 /pp_sys.c
parent92ca9816760477489e51e09e0dcde1dda70f387d (diff)
downloadperl-7a5fd60d4ce737f71e7a689eaa2061a36dd225dc.tar.gz
Stage 1 of utf8 support for soft references.
Change gv_fetchpv to take a UTF8 flag, as gv_fetchpvn_flags Add gv_fetchsv to look up a GV by SV rather than a char * pointer Provide a backwards compatability gv_fetchpv Migrate from gv_fetchpv to gv_fetchsv where the caller was grabbing the pointer from an SV All tests still pass. p4raw-id: //depot/perl@23766
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 356f6f2a8f..e0d9ca065d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -1337,7 +1337,7 @@ PP(pp_leavewrite)
if (!IoFMT_NAME(io))
IoFMT_NAME(io) = savepv(GvNAME(gv));
topname = sv_2mortal(Perl_newSVpvf(aTHX_ "%s_TOP", GvNAME(gv)));
- topgv = gv_fetchpv(SvPVX(topname), FALSE, SVt_PVFM);
+ topgv = gv_fetchsv(topname, FALSE, SVt_PVFM);
if ((topgv && GvFORM(topgv)) ||
!gv_fetchpv("top",FALSE,SVt_PVFM))
IoTOP_NAME(io) = savepv(SvPVX(topname));
@@ -2111,13 +2111,12 @@ PP(pp_truncate)
SETERRNO(0,0);
#if defined(HAS_TRUNCATE) || defined(HAS_CHSIZE) || defined(F_FREESP)
{
- STRLEN n_a;
int result = 1;
GV *tmpgv;
IO *io;
if (PL_op->op_flags & OPf_SPECIAL) {
- tmpgv = gv_fetchpv(POPpx, FALSE, SVt_PVIO);
+ tmpgv = gv_fetchsv(POPs, FALSE, SVt_PVIO);
do_ftruncate_gv:
if (!GvIO(tmpgv))
@@ -2144,7 +2143,8 @@ PP(pp_truncate)
else {
SV *sv = POPs;
char *name;
-
+ STRLEN n_a;
+
if (SvTYPE(sv) == SVt_PVGV) {
tmpgv = (GV*)sv; /* *main::FRED for example */
goto do_ftruncate_gv;
@@ -3348,8 +3348,7 @@ PP(pp_fttty)
dSP;
int fd;
GV *gv;
- char *tmps = Nullch;
- STRLEN n_a;
+ SV *tmpsv = Nullsv;
STACKED_FTEST_CHECK;
@@ -3360,12 +3359,18 @@ PP(pp_fttty)
else if (SvROK(TOPs) && isGV(SvRV(TOPs)))
gv = (GV*)SvRV(POPs);
else
- gv = gv_fetchpv(tmps = POPpx, FALSE, SVt_PVIO);
+ gv = gv_fetchsv(tmpsv = POPs, FALSE, SVt_PVIO);
if (GvIO(gv) && IoIFP(GvIOp(gv)))
fd = PerlIO_fileno(IoIFP(GvIOp(gv)));
- else if (tmps && isDIGIT(*tmps))
- fd = atoi(tmps);
+ else if (tmpsv && SvOK(tmpsv)) {
+ STRLEN n_a;
+ char *tmps = SvPV(tmpsv, n_a);
+ if (isDIGIT(*tmps))
+ fd = atoi(tmps);
+ else
+ RETPUSHUNDEF;
+ }
else
RETPUSHUNDEF;
if (PerlLIO_isatty(fd))