In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/89d84ff965b644c21c4c0633253e4cb21f72b62c?hp=4b523e790cc5594fb19013dc23adfb6a5b34f824>

- Log -----------------------------------------------------------------
commit 89d84ff965b644c21c4c0633253e4cb21f72b62c
Author: Hugo van der Sanden <[email protected]>
Date:   Thu Jun 11 12:25:40 2015 +0100

    [perl #125381] fix -Cnn parsing
    
    Commit 22ff313068 for [perl #123814] inadvertently changed the logic when
    parsing a numeric parameter to the -C option, such that the successfully
    parsed number was not saved as the option value if it parsed to the end
    of the argument.
-----------------------------------------------------------------------

Summary of changes:
 t/run/switchC.t |  7 ++++++-
 util.c          | 17 ++++++++---------
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/t/run/switchC.t b/t/run/switchC.t
index f6aa868..4f63c3b 100644
--- a/t/run/switchC.t
+++ b/t/run/switchC.t
@@ -11,7 +11,7 @@ BEGIN {
     skip_all_if_miniperl('-C and $ENV{PERL_UNICODE} are disabled on miniperl');
 }
 
-plan(tests => 13);
+plan(tests => 14);
 
 my $r;
 
@@ -25,6 +25,11 @@ $r = runperl( switches => [ '-CO', '-w' ],
               stderr   => 1 );
 like( $r, qr/^$b(?:\r?\n)?$/s, '-CO: no warning on UTF-8 output' );
 
+$r = runperl( switches => [ '-C2', '-w' ],
+             prog     => 'print chr(256)',
+              stderr   => 1 );
+like( $r, qr/^$b(?:\r?\n)?$/s, '-C2: no warning on UTF-8 output' );
+
 SKIP: {
     if (exists $ENV{PERL_UNICODE} &&
        ($ENV{PERL_UNICODE} eq "" || $ENV{PERL_UNICODE} =~ /[SO]/)) {
diff --git a/util.c b/util.c
index bc2af99..990c083 100644
--- a/util.c
+++ b/util.c
@@ -4423,16 +4423,15 @@ Perl_parse_unicode_opts(pTHX_ const char **popt)
        if (isDIGIT(*p)) {
             const char* endptr;
             UV uv;
-            if (grok_atoUV(p, &uv, &endptr)
-                && uv <= U32_MAX
-                && (p = endptr)
-                && *p && *p != '\n' && *p != '\r'
-            ) {
+            if (grok_atoUV(p, &uv, &endptr) && uv <= U32_MAX) {
                 opt = (U32)uv;
-                if (isSPACE(*p))
-                    goto the_end_of_the_opts_parser;
-                else
-                    Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", *p);
+                p = endptr;
+                if (p && *p && *p != '\n' && *p != '\r') {
+                    if (isSPACE(*p))
+                        goto the_end_of_the_opts_parser;
+                    else
+                        Perl_croak(aTHX_ "Unknown Unicode option letter '%c'", 
*p);
+                }
             }
         }
         else {

--
Perl5 Master Repository

Reply via email to