From: Rafael Garcia-Suarez Date: Wed, 4 Aug 2004 06:55:46 +0000 (+0000) Subject: Remove the "Newline in left-justified string" warning. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6af654855041e350ad1ba2c39f0be19af24f50c6;p=p5sagit%2Fp5-mst-13.2.git Remove the "Newline in left-justified string" warning. p4raw-id: //depot/perl@23192 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index dee8ff2..1b4ab09 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2324,15 +2324,6 @@ C appear to be nested quantifiers, but aren't. See L. (S internal) The symbol in question was declared but somehow went out of scope before it could possibly have been used. -=item Newline in left-justified string for %s - -(W printf) There is a newline in a string to be left justified by -C or C. - -The padding spaces will appear after the newline, which is probably not -what you wanted. Usually you should remove the newline from the string -and put formatting characters in the C format. - =item No %s allowed while running setuid (F) Certain operations are deemed to be too insecure for a setuid or diff --git a/sv.c b/sv.c index e71c03c..ce16807 100644 --- a/sv.c +++ b/sv.c @@ -10049,14 +10049,7 @@ Perl_sv_vcatpvfn(pTHX_ SV *sv, const char *pat, STRLEN patlen, va_list *args, SV p = SvEND(sv); *p = '\0'; } - /* Use memchr() instead of strchr(), as eptr is not guaranteed */ - /* to point to a null-terminated string. */ - if (left && ckWARN(WARN_PRINTF) && memchr(eptr, '\n', elen) && - (PL_op->op_type == OP_PRTF || PL_op->op_type == OP_SPRINTF)) - Perl_warner(aTHX_ packWARN(WARN_PRINTF), - "Newline in left-justified string for %sprintf", - (PL_op->op_type == OP_PRTF) ? "" : "s"); - + need = (have > width ? have : width); gap = need - have; diff --git a/t/lib/warnings/sv b/t/lib/warnings/sv index bf01657..1276ee0 100644 --- a/t/lib/warnings/sv +++ b/t/lib/warnings/sv @@ -365,22 +365,3 @@ no warnings 'numeric' ; $a = "\x{100}\x{200}"; $a = -$a; EXPECT Argument "\x{100}\x{200}" isn't numeric in negation (-) at - line 3. -######## -# sv.c -open F, ">".($^O eq 'VMS'? 'NL:' : '/dev/null') ; -use warnings 'printf'; -$a = "a\nb"; -$s = sprintf "%4s", $a; -printf F "%4s", $a; -$s = sprintf "%-4s", $a; -printf F "%-4s", $a; -$s = sprintf "%*s", -4, $a; -no warnings 'printf'; -$s = sprintf "%4s", $a; -printf F "%4s", $a; -$s = sprintf "%-4s", $a; -printf F "%-4s", $a; -EXPECT -Newline in left-justified string for sprintf at - line 7. -Newline in left-justified string for printf at - line 8. -Newline in left-justified string for sprintf at - line 9.