summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2000-12-09 13:49:40 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2000-12-09 13:49:40 +0000
commit7889fe52c8bdedf274e4826ad460ef6c3606ca6a (patch)
tree3d161635f94f9d03924fbf79676ba0e4c27ae2ae /mg.c
parent553151e7a76c75a9f0ccbf6e0802e72fde2ec8f2 (diff)
downloadperl-7889fe52c8bdedf274e4826ad460ef6c3606ca6a.tar.gz
UTF8 output prework.
- Store $\ and $, as SVs so they can have SvUTF8 flag - use do_print() rather than raw PerlIO_write() to print them. p4raw-id: //depot/perlio@8049
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/mg.c b/mg.c
index 52e1b0d7f0..f97c6cedb0 100644
--- a/mg.c
+++ b/mg.c
@@ -444,10 +444,6 @@ Perl_magic_len(pTHX_ SV *sv, MAGIC *mg)
}
}
return 0;
- case ',':
- return (STRLEN)PL_ofslen;
- case '\\':
- return (STRLEN)PL_orslen;
}
magic_get(sv,mg);
if (!SvPOK(sv) && SvNIOK(sv)) {
@@ -719,10 +715,8 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
sv_setiv(sv, (IV)(IoFLAGS(GvIOp(PL_defoutgv)) & IOf_FLUSH) != 0 );
break;
case ',':
- sv_setpvn(sv,PL_ofs,PL_ofslen);
break;
case '\\':
- sv_setpvn(sv,PL_ors,PL_orslen);
break;
case '#':
sv_setpv(sv,PL_ofmt);
@@ -1817,21 +1811,24 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg)
PL_rs = SvREFCNT_inc(PL_nrs);
break;
case '\\':
- if (PL_ors)
- Safefree(PL_ors);
+ if (PL_ors_sv)
+ SvREFCNT_dec(PL_ors_sv);
if (SvOK(sv) || SvGMAGICAL(sv)) {
- s = SvPV(sv,PL_orslen);
- PL_ors = savepvn(s,PL_orslen);
+ PL_ors_sv = newSVsv(sv);
}
else {
- PL_ors = Nullch;
- PL_orslen = 0;
+ PL_ors_sv = Nullsv;
}
break;
case ',':
- if (PL_ofs)
- Safefree(PL_ofs);
- PL_ofs = savepv(SvPV(sv, PL_ofslen));
+ if (PL_ofs_sv)
+ SvREFCNT_dec(PL_ofs_sv);
+ if (SvOK(sv) || SvGMAGICAL(sv)) {
+ PL_ofs_sv = newSVsv(sv);
+ }
+ else {
+ PL_ofs_sv = Nullsv;
+ }
break;
case '#':
if (PL_ofmt)