In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/91e8af102d3aa2fe6d31f64d9b5b1fad025cf8d7?hp=349c8cee6c078a03e5d96f45547833fcfe03b866>

- Log -----------------------------------------------------------------
commit 91e8af102d3aa2fe6d31f64d9b5b1fad025cf8d7
Author: Karl Williamson <[email protected]>
Date:   Sun Jan 13 13:31:38 2013 -0700

    regcomp.c: Stop potential leaks
    
    These two ref counts were not at the same level as their corresponding
    dec.

M       regcomp.c

commit 5afae9ed1cf4a0d2c8babbbade3fb39280883885
Author: Karl Williamson <[email protected]>
Date:   Sun Jan 13 13:28:09 2013 -0700

    regcomp.c: Add comments; align ternary operator for clarity

M       regcomp.c

commit 40e98def48aeff3ce255ceb92f935467f001947c
Author: Karl Williamson <[email protected]>
Date:   Sun Jan 13 11:46:27 2013 -0700

    reg_mesg.t: Add, revise test names

M       t/re/reg_mesg.t

commit fb44ace08c5d745b17d37964a7d760893f3ad836
Author: Karl Williamson <[email protected]>
Date:   Sun Jan 13 11:11:20 2013 -0700

    embed.fnc: Clarify that varargs suppresses embed.h
    
    Macro don't have variable numbers of args, hence the entry in embed.h is
    suppressed.

M       embed.fnc
-----------------------------------------------------------------------

Summary of changes:
 embed.fnc       |    3 ++-
 regcomp.c       |   27 +++++++++++++++++----------
 t/re/reg_mesg.t |    6 +++---
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/embed.fnc b/embed.fnc
index ccfc38a..730691a 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -51,7 +51,8 @@
 :      Should always be combined with "X" to be usable from dynamically
 :      loaded extensions.
 :
-:   f  Function takes printf style format string, varargs:
+:   f  Function takes printf style format string, varargs (hence any entry that
+:      would otherwise go in embed.h is suppressed):
 :
 :         proto.h: add __attribute__format__ (or ...null_ok__)
 :
diff --git a/regcomp.c b/regcomp.c
index 06b9f79..53e84f8 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -10700,7 +10700,8 @@ tryagain:
                            }
                            p += numlen;
                        }
-                       else {
+                        else {  /* Not to be treated as an octal constant, go
+                                   find backref */
                            --p;
                            goto loopdone;
                        }
@@ -11729,8 +11730,13 @@ S_handle_sets(pTHX_ RExC_state_t *pRExC_state, I32 
*flagp, U32 depth,
 
 STATIC regnode *
 S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, U32 depth,
-                 const bool stop_at_1, bool allow_multi_folds,
-                 const bool silence_non_portable, SV** ret_invlist)
+                 const bool stop_at_1,  /* Just parse the next thing, don't
+                                           look for a full character class */
+                 bool allow_multi_folds,
+                 const bool silence_non_portable,   /* Don't output warnings
+                                                       about too large
+                                                       characters */
+                 SV** ret_invlist)  /* Return an inversion list, not a node */
 {
     /* parse a bracketed class specification.  Most of these will produce an
      * ANYOF node; but something like [a] will produce an EXACT node; [aA], an
@@ -11774,8 +11780,9 @@ S_regclass(pTHX_ RExC_state_t *pRExC_state, I32 *flagp, 
U32 depth,
                                        character; used under /i */
     UV n;
     char * stop_ptr = RExC_end;    /* where to stop parsing */
-    const bool skip_white = cBOOL(ret_invlist);
-    const bool strict = cBOOL(ret_invlist);
+    const bool skip_white = cBOOL(ret_invlist); /* ignore unescaped white
+                                                   space? */
+    const bool strict = cBOOL(ret_invlist); /* Apply strict parsing rules? */
 
     /* Unicode properties are stored in a swash; this holds the current one
      * being parsed.  If this swash is the only above-latin1 component of the
@@ -12196,8 +12203,8 @@ parseit:
                         ckWARN2reg(RExC_parse,
                             "Unrecognized escape \\%c in character class 
passed through",
                             (int)value);
+                        (void)ReREFCNT_inc(RExC_rx_sv);
                     }
-                   (void)ReREFCNT_inc(RExC_rx_sv);
                    SvREFCNT_inc_simple_void_NN(listsv);
                }
                break;
@@ -12241,9 +12248,9 @@ parseit:
             * the 'a' in the examples */
            if (range) {
                if (!SIZE_ONLY) {
-                   const int w =
-                       RExC_parse >= rangebegin ?
-                       RExC_parse - rangebegin : 0;
+                   const int w = (RExC_parse >= rangebegin)
+                                  ? RExC_parse - rangebegin
+                                  : 0;
                    SAVEFREESV(listsv); /* in case of fatal warnings */
                     if (strict) {
                         vFAIL4("False [] range \"%*.*s\"", w, w, rangebegin);
@@ -12254,10 +12261,10 @@ parseit:
                                 "False [] range \"%*.*s\"",
                                 w, w, rangebegin);
                         (void)ReREFCNT_inc(RExC_rx_sv);
-                        SvREFCNT_inc_simple_void_NN(listsv);
                         cp_list = add_cp_to_invlist(cp_list, '-');
                         cp_list = add_cp_to_invlist(cp_list, prevvalue);
                     }
+                    SvREFCNT_inc_simple_void_NN(listsv);
                }
 
                range = 0; /* this was not a true range */
diff --git a/t/re/reg_mesg.t b/t/re/reg_mesg.t
index 548b3d2..7487421 100644
--- a/t/re/reg_mesg.t
+++ b/t/re/reg_mesg.t
@@ -177,8 +177,8 @@ while (my ($regex, $expect) = splice @death, 0, 2) {
     warning_is(sub {
                   $_ = "x";
                   eval $regex;
-                  like($@, qr/\Q$expect/);
-              }, undef, "$regex died without any other warnings");
+                  like($@, qr/\Q$expect/, $regex);
+              }, undef, "... and died without any other warnings");
 }
 
 while (my ($regex, $expect) = splice @warning, 0, 2) {
@@ -187,7 +187,7 @@ while (my ($regex, $expect) = splice @warning, 0, 2) {
                     $_ = "x";
                     eval $regex;
                     is($@, '', "$regex did not die");
-                }, qr/\Q$expect/);
+                }, qr/\Q$expect/, "... and gave expected warning");
 }
 
 done_testing();

--
Perl5 Master Repository

Reply via email to