summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorNick Ing-Simmons <nik@tiuk.ti.com>2002-01-15 08:19:08 +0000
committerNick Ing-Simmons <nik@tiuk.ti.com>2002-01-15 08:19:08 +0000
commitf1f8f8925a02a6ca4f9ef21b150b369edc63630d (patch)
tree6e3a25860d4c3ec95cf6b0fb42b32548e001155b /sv.c
parenta594c7b4495766324bc28504b0f4af2b5424ed02 (diff)
parent92e830a9086d75f086574c378b1c63ff2e00edcf (diff)
downloadperl-f1f8f8925a02a6ca4f9ef21b150b369edc63630d.tar.gz
Integrate rest of mainline
p4raw-id: //depot/perlio@14270
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 0cd86d6e39..7488bd90b9 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);
- p = SvEND(sv);
- }
- }
- else {
- SV *nsv = sv_2mortal(newSVpvn(eptr, elen));
- sv_utf8_upgrade(nsv);
- eptr = SvPVX(nsv);
- elen = SvCUR(nsv);
- }
- }
Copy(eptr, p, elen, char);
p += elen;
}