This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Add parameter to static function
authorKarl Williamson <khw@cpan.org>
Thu, 19 Sep 2019 20:20:59 +0000 (14:20 -0600)
committerKarl Williamson <khw@cpan.org>
Mon, 18 Nov 2019 03:59:41 +0000 (20:59 -0700)
This further decouples this function from knowing details of the calling
structure, by passing this detail in.

embed.fnc
embed.h
proto.h
regcomp.c

index 5579dee..1a9d3bf 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -2719,6 +2719,7 @@ ES        |bool   |put_charclass_bitmap_innards|NN SV* sv             \
                                |NULLOK SV* nonbitmap_invlist       \
                                |NULLOK SV* only_utf8_locale_invlist\
                                |NULLOK const regnode * const node  \
+                               |const U8 flags                     \
                                |const bool force_as_is_display
 ES     |SV*    |put_charclass_bitmap_innards_common                \
                                |NN SV* invlist                     \
diff --git a/embed.h b/embed.h
index 2f98e7b..a325515 100644 (file)
--- a/embed.h
+++ b/embed.h
 #define dump_trie_interim_list(a,b,c,d,e)      S_dump_trie_interim_list(aTHX_ a,b,c,d,e)
 #define dump_trie_interim_table(a,b,c,d,e)     S_dump_trie_interim_table(aTHX_ a,b,c,d,e)
 #define dumpuntil(a,b,c,d,e,f,g,h)     S_dumpuntil(aTHX_ a,b,c,d,e,f,g,h)
-#define put_charclass_bitmap_innards(a,b,c,d,e,f)      S_put_charclass_bitmap_innards(aTHX_ a,b,c,d,e,f)
+#define put_charclass_bitmap_innards(a,b,c,d,e,f,g)    S_put_charclass_bitmap_innards(aTHX_ a,b,c,d,e,f,g)
 #define put_charclass_bitmap_innards_common(a,b,c,d,e,f)       S_put_charclass_bitmap_innards_common(aTHX_ a,b,c,d,e,f)
 #define put_charclass_bitmap_innards_invlist(a,b)      S_put_charclass_bitmap_innards_invlist(aTHX_ a,b)
 #define put_code_point(a,b)    S_put_code_point(aTHX_ a,b)
diff --git a/proto.h b/proto.h
index 251ef12..bae22c2 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -4460,7 +4460,7 @@ STATIC void       S_dump_trie_interim_table(pTHX_ const struct _reg_trie_data *trie, H
 STATIC const regnode*  S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node, const regnode *last, const regnode *plast, SV* sv, I32 indent, U32 depth);
 #define PERL_ARGS_ASSERT_DUMPUNTIL     \
        assert(r); assert(start); assert(node); assert(sv)
-STATIC bool    S_put_charclass_bitmap_innards(pTHX_ SV* sv, char* bitmap, SV* nonbitmap_invlist, SV* only_utf8_locale_invlist, const regnode * const node, const bool force_as_is_display);
+STATIC bool    S_put_charclass_bitmap_innards(pTHX_ SV* sv, char* bitmap, SV* nonbitmap_invlist, SV* only_utf8_locale_invlist, const regnode * const node, const U8 flags, const bool force_as_is_display);
 #define PERL_ARGS_ASSERT_PUT_CHARCLASS_BITMAP_INNARDS  \
        assert(sv)
 STATIC SV*     S_put_charclass_bitmap_innards_common(pTHX_ SV* invlist, SV* posixes, SV* only_utf8, SV* not_utf8, SV* only_utf8_locale, const bool invert);
index c72a444..7d905b1 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -20514,6 +20514,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
                                                 NULL,
                                                 NULL,
                                                 NULL,
+                                                0,
                                                 FALSE
                                                );
             sv_catpvs(sv, "]");
@@ -20662,6 +20663,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
                                                   bitmap_range_not_in_bitmap,
                                                   only_utf8_locale_invlist,
                                                   o,
+                                                  flags,
 
                                                   /* Can't try inverting for a
                                                    * better display if there
@@ -20779,7 +20781,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_
             _invlist_invert(cp_list);
         }
 
-        put_charclass_bitmap_innards(sv, NULL, cp_list, NULL, NULL, TRUE);
+        put_charclass_bitmap_innards(sv, NULL, cp_list, NULL, NULL, 0, TRUE);
        Perl_sv_catpvf(aTHX_ sv, "%s]", PL_colors[1]);
 
         SvREFCNT_dec(cp_list);
@@ -21860,6 +21862,7 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
                                      SV *nonbitmap_invlist,
                                      SV *only_utf8_locale_invlist,
                                      const regnode * const node,
+                                     const U8 flags,
                                      const bool force_as_is_display)
 {
     /* Appends to 'sv' a displayable version of the innards of the bracketed
@@ -21876,6 +21879,7 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
      *  'node' is the regex pattern ANYOF node.  It is needed only when the
      *      above two parameters are not null, and is passed so that this
      *      routine can tease apart the various reasons for them.
+     *  'flags' is the flags field of 'node'
      *  'force_as_is_display' is TRUE if this routine should definitely NOT try
      *      to invert things to see if that leads to a cleaner display.  If
      *      FALSE, this routine is free to use its judgment about doing this.
@@ -21914,8 +21918,6 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv,
                                literally */
     SV* inverted_display;   /* The output string when we invert the inputs */
 
-    U8 flags = (node) ? ANYOF_FLAGS(node) : 0;
-
     bool invert = cBOOL(flags & ANYOF_INVERT);  /* Is the input to be inverted
                                                    to match? */
     /* We are biased in favor of displaying things without them being inverted,