summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2002-01-13 19:38:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2002-01-13 19:38:17 +0000
commitd2876be5b271f570ff7582f2abd26166bc9d3060 (patch)
tree9a016d47a8ec8501fa0b3619010ccf26eff4eca2 /sv.c
parent9c3c560ba6bc15821847ad7cb7e9463f1d0126d0 (diff)
downloadperl-d2876be5b271f570ff7582f2abd26166bc9d3060.tar.gz
Move the UTF-8 conversion code earlier so that
op/ver is happy. p4raw-id: //depot/perl@14246
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/sv.c b/sv.c
index 0e0c5fcf44..006fb8c5f8 100644
--- a/sv.c
+++ b/sv.c
@@ -8337,6 +8337,22 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
continue; /* not "break" */
}
+ if (is_utf8 != has_utf8) {
+ if (is_utf8) {
+ if (SvCUR(sv))
+ sv_utf8_upgrade(sv);
+ }
+ else {
+ SV *nsv = sv_2mortal(newSVpvn(eptr, elen));
+ sv_utf8_upgrade(nsv);
+ eptr = SvPVX(nsv);
+ elen = SvCUR(nsv);
+ }
+ SvGROW(sv, SvCUR(sv) + elen + 1);
+ p = SvEND(sv);
+ *p = '\0';
+ }
+
have = esignlen + zeros + elen;
need = (have > width ? have : width);
gap = need - have;
@@ -8360,20 +8376,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
*p++ = '0';
}
if (elen) {
- if (is_utf8 != has_utf8) {
- if (is_utf8) {
- if (SvCUR(sv))
- sv_utf8_upgrade(sv);
- }
- else {
- SV *nsv = sv_2mortal(newSVpvn(eptr, elen));
- sv_utf8_upgrade(nsv);
- eptr = SvPVX(nsv);
- elen = SvCUR(nsv);
- }
- SvGROW(sv, SvCUR(sv) + elen + 1);
- p = SvEND(sv);
- }
Copy(eptr, p, elen, char);
p += elen;
}