diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-30 06:19:18 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-12-30 06:19:18 +0000 |
commit | 0c981600188aac3b6bf2ea127df9e7da5bd4b1a3 (patch) | |
tree | d93810619259c25bb42caeab89670d1bb528bb47 /sv.c | |
parent | f0e40504961b24be8b96e8007fefc833f9e69328 (diff) | |
download | perl-0c981600188aac3b6bf2ea127df9e7da5bd4b1a3.tar.gz |
Undo all the join-related changes since #8248: relevant
portions of 8248, 8249, 8250, 8251, 8260, 8263 must go.
The new sv_catsv() doesn't fly so it must go back to
the drawing board.
p4raw-id: //depot/perl@8264
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 81 |
1 files changed, 23 insertions, 58 deletions
@@ -2934,7 +2934,7 @@ Perl_sv_utf8_upgrade(pTHX_ register SV *sv) char *s, *t, *e; int hibit = 0; - if (!sv || !SvPOK(sv) || !SvCUR(sv) || SvUTF8(sv)) + if (!sv || !SvPOK(sv) || SvUTF8(sv)) return; /* This function could be much more efficient if we had a FLAG in SVs @@ -3755,55 +3755,20 @@ C<dsv>. Handles 'get' magic, but not 'set' magic. See C<sv_catsv_mg>. */ void -Perl_sv_catsv(pTHX_ SV *dsv, register SV *ssv) +Perl_sv_catsv(pTHX_ SV *dstr, register SV *sstr) { - if (!ssv) + char *s; + STRLEN len; + if (!sstr) return; - else { - STRLEN slen; - char *spv; - - if ((spv = SvPV(ssv, slen))) { - bool dutf8 = DO_UTF8(dsv); - bool sutf8 = DO_UTF8(ssv); - - if (dutf8 != sutf8) { - STRLEN dlen; - char *dpv; - - /* We may modify dsv but not ssv. */ - - if (!dutf8) - sv_utf8_upgrade(dsv); - dpv = SvPV(dsv, dlen); - SvGROW(dsv, dlen + 2 * slen + 1); - if (dutf8) /* && !sutf8 */ { - char *s = spv; - char *e = s + slen; - char *d = dpv + dlen; - char *dorig = d; - - while (s < e) { - U8 c = *s++; - - if (UTF8_IS_ASCII(c)) - *d++ = c; - else { - *d++ = UTF8_EIGHT_BIT_HI(c); - *d++ = UTF8_EIGHT_BIT_LO(c); - } - } - SvCUR(dsv) += d - dorig; - *d = 0; - } - else /* !dutf8 (was) && sutf8 */ { - sv_catpvn(dsv, spv, slen); - SvUTF8_on(dsv); - } - } - else - sv_catpvn(dsv, spv, slen); + if ((s = SvPV(sstr, len))) { + if (DO_UTF8(sstr)) { + sv_utf8_upgrade(dstr); + sv_catpvn(dstr,s,len); + SvUTF8_on(dstr); } + else + sv_catpvn(dstr,s,len); } } @@ -3816,10 +3781,10 @@ Like C<sv_catsv>, but also handles 'set' magic. */ void -Perl_sv_catsv_mg(pTHX_ SV *dsv, register SV *ssv) +Perl_sv_catsv_mg(pTHX_ SV *dstr, register SV *sstr) { - sv_catsv(dsv,ssv); - SvSETMAGIC(dsv); + sv_catsv(dstr,sstr); + SvSETMAGIC(dstr); } /* @@ -3832,20 +3797,20 @@ Handles 'get' magic, but not 'set' magic. See C<sv_catpv_mg>. */ void -Perl_sv_catpv(pTHX_ register SV *sv, register const char *pv) +Perl_sv_catpv(pTHX_ register SV *sv, register const char *ptr) { register STRLEN len; STRLEN tlen; char *junk; - if (!pv) + if (!ptr) return; junk = SvPV_force(sv, tlen); - len = strlen(pv); + len = strlen(ptr); SvGROW(sv, tlen + len + 1); - if (pv == junk) - pv = SvPVX(sv); - Move(pv,SvPVX(sv)+tlen,len+1,char); + if (ptr == junk) + ptr = SvPVX(sv); + Move(ptr,SvPVX(sv)+tlen,len+1,char); SvCUR(sv) += len; (void)SvPOK_only_UTF8(sv); /* validate pointer */ SvTAINT(sv); @@ -3860,9 +3825,9 @@ Like C<sv_catpv>, but also handles 'set' magic. */ void -Perl_sv_catpv_mg(pTHX_ register SV *sv, register const char *pv) +Perl_sv_catpv_mg(pTHX_ register SV *sv, register const char *ptr) { - sv_catpv(sv,pv); + sv_catpv(sv,ptr); SvSETMAGIC(sv); } |