diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-10-19 14:14:05 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-10-20 12:38:06 -0700 |
commit | 810a07df93924c82fc5bbe83c8f12a0def2fb61d (patch) | |
tree | bdc1bc1b5a7834718250e9b4fcb247388d1c04a9 /doop.c | |
parent | b3153e044595a17d3f7e3c62468beb8c8f8ac96d (diff) | |
download | perl-810a07df93924c82fc5bbe83c8f12a0def2fb61d.tar.gz |
Call string overloading once in join($ov,...)
Diffstat (limited to 'doop.c')
-rw-r--r-- | doop.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -669,12 +669,10 @@ Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp) I32 items = sp - mark; STRLEN len; STRLEN delimlen; + const char * const delims = SvPV_const(delim, delimlen); PERL_ARGS_ASSERT_DO_JOIN; - (void) SvPV_const(delim, delimlen); /* stringify and get the delimlen */ - /* SvCUR assumes it's SvPOK() and woe betide you if it's not. */ - mark++; len = (items > 0 ? (delimlen * (items - 1) ) : 0); SvUPGRADE(sv, SVt_PV); @@ -708,10 +706,11 @@ Perl_do_join(pTHX_ SV *sv, SV *delim, SV **mark, SV **sp) } if (delimlen) { + const U32 delimflag = DO_UTF8(delim) ? SV_CATUTF8 : SV_CATBYTES; for (; items > 0; items--,mark++) { STRLEN len; const char *s; - sv_catsv_nomg(sv,delim); + sv_catpvn_flags(sv,delims,delimlen,delimflag); s = SvPV_const(*mark,len); sv_catpvn_flags(sv,s,len, DO_UTF8(*mark) ? SV_CATUTF8 : SV_CATBYTES); |