summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian M. Enache <enache@rdslink.ro>2003-03-08 01:28:37 +0200
committerJarkko Hietaniemi <jhi@iki.fi>2003-03-09 11:46:17 +0000
commit58e33a9028ebaa2c94f6b7cf202a415b19dab366 (patch)
treefefebdd479a6e413e819d5b82b6a9377e6028421
parentb14574b4c5983698eb9d1a38f94eef3a65c411c2 (diff)
downloadperl-58e33a9028ebaa2c94f6b7cf202a415b19dab366.tar.gz
Re: [perl #21498] printf behaviour changes 5.6.1(and earlier) -> 5.8
Message-ID: <20030307212837.GB765@ratsnest.hole> (and few more test cases from the thread) p4raw-id: //depot/perl@18861
-rw-r--r--sv.c3
-rwxr-xr-xt/op/sprintf.t9
2 files changed, 9 insertions, 3 deletions
diff --git a/sv.c b/sv.c
index effecb7a00..cc6f6c288c 100644
--- a/sv.c
+++ b/sv.c
@@ -8358,6 +8358,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
STRLEN zeros = 0;
bool has_precis = FALSE;
STRLEN precis = 0;
+ I32 osvix = svix;
bool is_utf8 = FALSE; /* is this item utf8? */
#ifdef HAS_LDBL_SPRINTF_BUG
/* This is to try to fix a bug with irix/nonstop-ux/powerux and
@@ -9109,7 +9110,6 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
default:
unknown:
- vectorize = FALSE;
if (!args && ckWARN(WARN_PRINTF) &&
(PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)) {
SV *msg = sv_newmortal();
@@ -9141,6 +9141,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV
p += elen;
*p = '\0';
SvCUR(sv) = p - SvPVX(sv);
+ svix = osvix;
continue; /* not "break" */
}
diff --git a/t/op/sprintf.t b/t/op/sprintf.t
index e498c65b35..5a046eccac 100755
--- a/t/op/sprintf.t
+++ b/t/op/sprintf.t
@@ -359,7 +359,7 @@ __END__
>%2$d %d %d< >[12, 34]< >34 12 34<
>%3$d %d %d< >[12, 34, 56]< >56 12 34<
>%2$*3$d %d< >[12, 34, 3]< > 34 12<
->%*3$2$d %d< >[12, 34, 3]< >%*3$2$d 34 INVALID<
+>%*3$2$d %d< >[12, 34, 3]< >%*3$2$d 12 INVALID<
>%2$d< >12< >0 UNINIT<
>%0$d< >12< >%0$d INVALID<
>%1$$d< >12< >%1$$d INVALID<
@@ -374,4 +374,9 @@ __END__
>%vs,%d< >[1, 2, 3]< >1,2<
>%v_< >''< >%v_ INVALID<
>%v#x< >''< >%v#x INVALID<
->%v02x< >"foo\n"< >66.6f.6f.0a<
+>%v02x< >"foo\n"< >66.6f.6f.0a<
+>%V-%s< >["Hello"]< >%V-Hello INVALID<
+>%K %d %d< >[13, 29]< >%K 13 29 INVALID<
+>%*.*K %d< >[13, 29, 76]< >%*.*K 13 INVALID<
+>%4$K %d< >[45, 67]< >%4$K 45 INVALID<
+>%d %K %d< >[23, 45]< >23 %K 45 INVALID<