In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/2bfbbbaf9ef1783ba914ff9e9270e877fbbb6aba?hp=5105e860ee4e854010122018bbdbb8c1c1863539>
- Log ----------------------------------------------------------------- commit 2bfbbbaf9ef1783ba914ff9e9270e877fbbb6aba Author: Karl Williamson <[email protected]> Date: Thu Feb 18 21:47:15 2016 -0700 Add environment variable for -Dr: PERL_DUMP_RE_MAX_LEN The regex engine when displaying debugging info, say under -Dr, will elide data in order to keep the output from getting too long. For example, the number of code points in all of Unicode matched by \w is quite large, and so when displaying a pattern that matches this, only the first some number of them are printed, and the rest are truncated, represented by "...". Sometimes, one wants to see more than what the compiled-into-the-engine-max shows. This commit creates code to read this environment variable to override the default max lengths. This changes the lengths for everything to the input number, even if they have different compiled maximums in the absence of this variable. I'm not currently documenting this variable, as I don't think it works properly under threads, and we may want to alter the behavior in various ways as a result of gaining experience with using it. M embedvar.h M intrpvar.h M regcomp.c M regcomp.h commit c23916c6ad5c8be07a891f00941d5b842631906a Author: Karl Williamson <[email protected]> Date: Mon Feb 15 16:27:20 2016 -0700 regcomp.c: Save a branch test This branch will only be true if the answer to the previous branch was also true, so can just move it to within that to avoid an unnecessary test. M regcomp.c commit 41fc5e751327083b059aca69d464a84ae12715e4 Author: Karl Williamson <[email protected]> Date: Mon Feb 15 16:20:43 2016 -0700 regcomp.c: Clarify -Dr output under /l It is now redundant to indicate that an ANYOF node is for locale, as the regnode type ANYOFL now clearly indicates that. But also sometimes the node is only vaid if the runtime locale is a UTF-8 one. That was not clearly indicated. M regcomp.c commit 5f6fd4ab347e39f1fc1fa735e21b9b7051a8db68 Author: Karl Williamson <[email protected]> Date: Sat Feb 13 18:00:36 2016 -0700 regcomp.c: Comments, white-space, add grouping () for clarity M regcomp.c commit bb17e3266e6d1392f4152af8ef9115e2f0d2a06a Author: Karl Williamson <[email protected]> Date: Thu Feb 18 21:43:14 2016 -0700 Add a parameter to a static function This parameter will be used in a future commit, it changes the output format of this function that displays the contents of an inversion list so that it won't have to be parsed later, simplifying the code at that time. M embed.fnc M embed.h M proto.h M regcomp.c commit b9c1a2c52c1d56a2cc9c9ae73e72977d628c44ea Author: Karl Williamson <[email protected]> Date: Thu Feb 18 21:36:04 2016 -0700 Change private function to static This function was used outside the file it contains, but was only defined (by #ifdef's) for those few internal core files for which it was needed. Now all those uses have gone, save for the one file. Better to make it static so no one can circumvent those #ifdef's. M embed.fnc M embed.h M proto.h M regcomp.c commit 911bd04eeef784865e4400fef38495936f905e35 Author: Karl Williamson <[email protected]> Date: Thu Feb 18 21:08:24 2016 -0700 regcomp.c: Change structure element size and loc The 'strict' field is only a bool, but was declared I32, which led to warnings on some compilers when it was passed to a function expecting a bool. It is moved to the end of the structure, since it doesn't pack well with the rest. M regcomp.c ----------------------------------------------------------------------- Summary of changes: embed.fnc | 5 ++- embed.h | 4 +- embedvar.h | 1 + intrpvar.h | 2 + proto.h | 20 ++++----- regcomp.c | 139 ++++++++++++++++++++++++++++++++++++++++--------------------- regcomp.h | 21 ++++++---- 7 files changed, 121 insertions(+), 71 deletions(-) diff --git a/embed.fnc b/embed.fnc index a2cad1a..ab881ab 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1524,9 +1524,9 @@ EiMRn |UV* |_invlist_array_init |NN SV* const invlist|const bool will_have_0 EsM |void |invlist_extend |NN SV* const invlist|const UV len EiMRn |UV |invlist_max |NN SV* const invlist EiM |void |invlist_set_len|NN SV* const invlist|const UV len|const bool offset +EiMRn |bool |invlist_is_iterating|NN SV* const invlist #ifndef PERL_EXT_RE_BUILD EiMRn |IV* |get_invlist_previous_index_addr|NN SV* invlist -EiMRn |bool |invlist_is_iterating|NN SV* const invlist EiMn |void |invlist_set_previous_index|NN SV* const invlist|const IV index EiMRn |IV |invlist_previous_index|NN SV* const invlist EiMn |void |invlist_trim |NN SV* const invlist @@ -1539,6 +1539,8 @@ EiMn |void |invlist_iterfinish|NN SV* invlist EiMRn |UV |invlist_highest|NN SV* const invlist EMRs |SV* |_make_exactf_invlist |NN RExC_state_t *pRExC_state \ |NN regnode *node +EsMR |SV* |invlist_contents|NN SV* const invlist \ + |const bool traditional_style #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_UTF8_C) EXmM |void |_invlist_intersection |NN SV* const a|NN SV* const b|NN SV** i @@ -1564,7 +1566,6 @@ EXp |SV* |_core_swash_init|NN const char* pkg|NN const char* name \ #endif #if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) EiMRn |UV* |invlist_array |NN SV* const invlist -EXMpR |SV* |_invlist_contents|NN SV* const invlist EiMRn |bool* |get_invlist_offset_addr|NN SV* invlist EiMRn |UV |_invlist_len |NN SV* const invlist EMiRn |bool |_invlist_contains_cp|NN SV* const invlist|const UV cp diff --git a/embed.h b/embed.h index eb8ffa5..fa8f0f9 100644 --- a/embed.h +++ b/embed.h @@ -948,7 +948,6 @@ # if !defined(PERL_EXT_RE_BUILD) # if defined(PERL_IN_REGCOMP_C) #define get_invlist_previous_index_addr S_get_invlist_previous_index_addr -#define invlist_is_iterating S_invlist_is_iterating #define invlist_previous_index S_invlist_previous_index #define invlist_set_previous_index S_invlist_set_previous_index #define invlist_trim S_invlist_trim @@ -1001,8 +1000,10 @@ #define handle_possible_posix(a,b,c,d) S_handle_possible_posix(aTHX_ a,b,c,d) #define handle_regex_sets(a,b,c,d,e) S_handle_regex_sets(aTHX_ a,b,c,d,e) #define invlist_clone(a) S_invlist_clone(aTHX_ a) +#define invlist_contents(a,b) S_invlist_contents(aTHX_ a,b) #define invlist_extend(a,b) S_invlist_extend(aTHX_ a,b) #define invlist_highest S_invlist_highest +#define invlist_is_iterating S_invlist_is_iterating #define invlist_iterfinish S_invlist_iterfinish #define invlist_iterinit S_invlist_iterinit #define invlist_iternext S_invlist_iternext @@ -1059,7 +1060,6 @@ # if defined(PERL_IN_REGCOMP_C) || defined(PERL_IN_REGEXEC_C) || defined(PERL_IN_UTF8_C) #define _get_swash_invlist(a) Perl__get_swash_invlist(aTHX_ a) #define _invlist_contains_cp S__invlist_contains_cp -#define _invlist_contents(a) Perl__invlist_contents(aTHX_ a) #define _invlist_len S__invlist_len #define _invlist_search Perl__invlist_search #define _swash_inversion_hash(a) Perl__swash_inversion_hash(aTHX_ a) diff --git a/embedvar.h b/embedvar.h index 524ceb4..c366d47 100644 --- a/embedvar.h +++ b/embedvar.h @@ -134,6 +134,7 @@ #define PL_diehook (vTHX->Idiehook) #define PL_doswitches (vTHX->Idoswitches) #define PL_dowarn (vTHX->Idowarn) +#define PL_dump_re_max_len (vTHX->Idump_re_max_len) #define PL_dumper_fd (vTHX->Idumper_fd) #define PL_dumpindent (vTHX->Idumpindent) #define PL_e_script (vTHX->Ie_script) diff --git a/intrpvar.h b/intrpvar.h index 4f558a8..50a9ee0 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -807,6 +807,8 @@ PERLVARA(I, op_exec_cnt, OP_max+2, UV) /* Counts of executed OPs of the given ty PERLVAR(I, random_state, PL_RANDOM_STATE_TYPE) +PERLVARI(I, dump_re_max_len, STRLEN, 0) + /* If you are adding a U8 or U16, check to see if there are 'Space' comments * above on where there are gaps which currently will be structure padding. */ diff --git a/proto.h b/proto.h index 8f2b730..232086d 100644 --- a/proto.h +++ b/proto.h @@ -3659,11 +3659,6 @@ PERL_STATIC_INLINE IV* S_get_invlist_previous_index_addr(SV* invlist) #define PERL_ARGS_ASSERT_GET_INVLIST_PREVIOUS_INDEX_ADDR \ assert(invlist) -PERL_STATIC_INLINE bool S_invlist_is_iterating(SV* const invlist) - __attribute__warn_unused_result__; -#define PERL_ARGS_ASSERT_INVLIST_IS_ITERATING \ - assert(invlist) - PERL_STATIC_INLINE IV S_invlist_previous_index(SV* const invlist) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT_INVLIST_PREVIOUS_INDEX \ @@ -4750,6 +4745,11 @@ PERL_STATIC_INLINE SV* S_invlist_clone(pTHX_ SV* const invlist) #define PERL_ARGS_ASSERT_INVLIST_CLONE \ assert(invlist) +STATIC SV* S_invlist_contents(pTHX_ SV* const invlist, const bool traditional_style) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_INVLIST_CONTENTS \ + assert(invlist) + STATIC void S_invlist_extend(pTHX_ SV* const invlist, const UV len); #define PERL_ARGS_ASSERT_INVLIST_EXTEND \ assert(invlist) @@ -4758,6 +4758,11 @@ PERL_STATIC_INLINE UV S_invlist_highest(SV* const invlist) #define PERL_ARGS_ASSERT_INVLIST_HIGHEST \ assert(invlist) +PERL_STATIC_INLINE bool S_invlist_is_iterating(SV* const invlist) + __attribute__warn_unused_result__; +#define PERL_ARGS_ASSERT_INVLIST_IS_ITERATING \ + assert(invlist) + PERL_STATIC_INLINE void S_invlist_iterfinish(SV* invlist); #define PERL_ARGS_ASSERT_INVLIST_ITERFINISH \ assert(invlist) @@ -4933,11 +4938,6 @@ PERL_STATIC_INLINE bool S__invlist_contains_cp(SV* const invlist, const UV cp) #define PERL_ARGS_ASSERT__INVLIST_CONTAINS_CP \ assert(invlist) -PERL_CALLCONV SV* Perl__invlist_contents(pTHX_ SV* const invlist) - __attribute__warn_unused_result__; -#define PERL_ARGS_ASSERT__INVLIST_CONTENTS \ - assert(invlist) - PERL_STATIC_INLINE UV S__invlist_len(SV* const invlist) __attribute__warn_unused_result__; #define PERL_ARGS_ASSERT__INVLIST_LEN \ diff --git a/regcomp.c b/regcomp.c index 551c977..a2fe130 100644 --- a/regcomp.c +++ b/regcomp.c @@ -195,7 +195,6 @@ struct RExC_state_t { scan_frame *frame_head; scan_frame *frame_last; U32 frame_count; - U32 strict; #ifdef ADD_TO_REGEXEC char *starttry; /* -Dr: where regtry was called. */ #define RExC_starttry (pRExC_state->starttry) @@ -218,6 +217,7 @@ struct RExC_state_t { #endif bool seen_unfolded_sharp_s; + bool strict; }; #define RExC_flags (pRExC_state->flags) @@ -6700,6 +6700,10 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, /* Initialize these here instead of as-needed, as is quick and avoids * having to test them each time otherwise */ if (! PL_AboveLatin1) { +#ifdef DEBUGGING + char * dump_len_string; +#endif + PL_AboveLatin1 = _new_invlist_C_array(AboveLatin1_invlist); PL_Latin1 = _new_invlist_C_array(Latin1_invlist); PL_UpperLatin1 = _new_invlist_C_array(UpperLatin1_invlist); @@ -6713,6 +6717,14 @@ Perl_re_op_compile(pTHX_ SV ** const patternp, int pat_count, PL_InBitmap = _new_invlist(2); PL_InBitmap = _add_range_to_invlist(PL_InBitmap, 0, NUM_ANYOF_CODE_POINTS - 1); +#ifdef DEBUGGING + dump_len_string = PerlEnv_getenv("PERL_DUMP_RE_MAX_LEN"); + if ( ! dump_len_string + || ! grok_atoUV(dump_len_string, &PL_dump_re_max_len, NULL)) + { + PL_dump_re_max_len = 0; + } +#endif } pRExC_state->code_blocks = NULL; @@ -8381,6 +8393,8 @@ S_invlist_trim(SV* const invlist) SvPV_shrink_to_cur((SV *) invlist); } +#endif /* ifndef PERL_IN_XSUB_RE */ + PERL_STATIC_INLINE bool S_invlist_is_iterating(SV* const invlist) { @@ -8389,8 +8403,6 @@ S_invlist_is_iterating(SV* const invlist) return *(get_invlist_iter_addr(invlist)) < (STRLEN) UV_MAX; } -#endif /* ifndef PERL_IN_XSUB_RE */ - PERL_STATIC_INLINE UV S_invlist_max(SV* const invlist) { @@ -9513,38 +9525,56 @@ S_invlist_highest(SV* const invlist) : array[len - 1] - 1; } -#ifndef PERL_IN_XSUB_RE SV * -Perl__invlist_contents(pTHX_ SV* const invlist) +S_invlist_contents(pTHX_ SV* const invlist, const bool traditional_style) { /* Get the contents of an inversion list into a string SV so that they can - * be printed out. It uses the format traditionally done for debug tracing - */ + * be printed out. If 'traditional_style' is TRUE, it uses the format + * traditionally done for debug tracing; otherwise it uses a format + * suitable for just copying to the output, with blanks between ranges and + * a dash between range components */ UV start, end; - SV* output = newSVpvs("\n"); + SV* output; + const char intra_range_delimiter = (traditional_style ? '\t' : '-'); + const char inter_range_delimiter = (traditional_style ? '\n' : ' '); - PERL_ARGS_ASSERT__INVLIST_CONTENTS; + if (traditional_style) { + output = newSVpvs("\n"); + } + else { + output = newSVpvs(""); + } + + PERL_ARGS_ASSERT_INVLIST_CONTENTS; assert(! invlist_is_iterating(invlist)); invlist_iterinit(invlist); while (invlist_iternext(invlist, &start, &end)) { if (end == UV_MAX) { - Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\tINFINITY\n", start); + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"%cINFINITY%c", + start, intra_range_delimiter, + inter_range_delimiter); } else if (end != start) { - Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\t%04"UVXf"\n", - start, end); + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"%c%04"UVXf"%c", + start, + intra_range_delimiter, + end, inter_range_delimiter); } else { - Perl_sv_catpvf(aTHX_ output, "%04"UVXf"\n", start); + Perl_sv_catpvf(aTHX_ output, "%04"UVXf"%c", + start, inter_range_delimiter); } } + if (SvCUR(output) && ! traditional_style) {/* Get rid of trailing blank */ + SvCUR_set(output, SvCUR(output) - 1); + } + return output; } -#endif #ifndef PERL_IN_XSUB_RE void @@ -17441,8 +17471,12 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, * swash exists, by calling this function with 'doinit' set to false, in * which case the components that will be used to eventually create the * swash are returned (in a printable form). + * If <only_utf8_locale_ptr> is not NULL, it is where this routine is to + * store an inversion list of code points that should match only if the + * execution-time locale is a UTF-8 one. * If <exclude_list> is not NULL, it is an inversion list of things to * exclude from what's returned in <listsvp>. + * * Tied intimately to how S_set_ANYOF_arg sets up the data structure. Note * that, in spite of this function's name, the swash it returns may include * the bitmap data as well */ @@ -17535,11 +17569,11 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog, if (exclude_list) { SV* clone = invlist_clone(invlist); _invlist_subtract(clone, exclude_list, &clone); - sv_catsv(matches_string, _invlist_contents(clone)); + sv_catsv(matches_string, invlist_contents(clone, TRUE)); SvREFCNT_dec_NN(clone); } else { - sv_catsv(matches_string, _invlist_contents(invlist)); + sv_catsv(matches_string, invlist_contents(invlist, TRUE)); } } *listsvp = matches_string; @@ -18287,9 +18321,9 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ if ( IS_ANYOF_TRIE(op) || trie->bitmap ) { sv_catpvs(sv, "["); (void) put_charclass_bitmap_innards(sv, - (IS_ANYOF_TRIE(op)) + ((IS_ANYOF_TRIE(op)) ? ANYOF_BITMAP(o) - : TRIE_BITMAP(trie), + : TRIE_BITMAP(trie)), NULL); sv_catpvs(sv, "]"); } @@ -18376,28 +18410,25 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ int do_sep = 0; SV* bitmap_invlist = NULL; /* Will hold what the bit map contains */ - if (OP(o) == ANYOFL) { if (ANYOFL_UTF8_LOCALE_REQD(flags)) { - sv_catpvs(sv, "{utf8-loc}"); + sv_catpvs(sv, "{utf8-locale-reqd}"); } - else { - sv_catpvs(sv, "{loc}"); + if (flags & ANYOFL_FOLD) { + sv_catpvs(sv, "{i}"); } } - if (flags & ANYOFL_FOLD) - sv_catpvs(sv, "{i}"); Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]); if (flags & ANYOF_INVERT) sv_catpvs(sv, "^"); - /* output what the standard cp 0-NUM_ANYOF_CODE_POINTS-1 bitmap matches - * */ + /* Output what the bitmap matches, and get what that is into + * 'bitmap_invlist' */ do_sep = put_charclass_bitmap_innards(sv, ANYOF_BITMAP(o), &bitmap_invlist); - /* output any special charclass tests (used entirely under use - * locale) * */ + /* Output any special charclass tests (used entirely under 'use + * locale'). */ if (ANYOF_POSIXL_TEST_ANY_SET(o)) { int i; for (i = 0; i < ANYOF_POSIXL_MAX; i++) { @@ -18416,8 +18447,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ { if (do_sep) { Perl_sv_catpvf(aTHX_ sv,"%s][%s",PL_colors[1],PL_colors[0]); - if (flags & ANYOF_INVERT) - /*make sure the invert info is in each */ + if (flags & ANYOF_INVERT) /*make sure the invert info is in each */ sv_catpvs(sv, "^"); } @@ -18445,6 +18475,9 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ char *s = savesvpv(lv); const char * const orig_s = s; /* Save the beginning of 's', so can be freed */ + const STRLEN dump_len = (PL_dump_re_max_len) + ? PL_dump_re_max_len + : 256; /* Ignore anything before the first \n */ while (*s && *s != '\n') @@ -18473,7 +18506,7 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_ if (*s == '\n') { /* Truncate very long output */ - if ((UV) (s - t) > 256) { + if ((UV) (s - t) > dump_len) { Perl_sv_catpvf(aTHX_ sv, "%.*s...", (int) (s - t), @@ -19211,8 +19244,15 @@ STATIC void S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) { /* Appends to 'sv' a displayable version of the range of code points from - * 'start' to 'end'. It assumes that only ASCII printables are displayable - * as-is (though some of these will be escaped by put_code_point()). */ + * 'start' to 'end'. Mnemonics (like '\r') are used for the few controls + * that have them, when they occur at the beginning or end of the range. + * It uses hex to output the remaining code points, unless 'allow_literals' + * is true, in which case the printable ASCII ones are output as-is (though + * some of these will be escaped by put_code_point()). + * + * NOTE: This is designed only for printing ranges of code points that fit + * inside an ANYOF bitmap. Higher code points are simply suppressed + */ const unsigned int min_range_count = 3; @@ -19226,7 +19266,7 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) if (end - start < min_range_count) { - /* Individual chars in short ranges */ + /* Output chars individually when they occur in short ranges */ for (; start <= end; start++) { put_code_point(sv, start); } @@ -19235,11 +19275,11 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) /* If permitted by the input options, and there is a possibility that * this range contains a printable literal, look to see if there is - * one. */ + * one. */ if (allow_literals && start <= MAX_PRINT_A) { - /* If the range begin isn't an ASCII printable, effectively split - * the range into two parts: + /* If the character at the beginning of the range isn't an ASCII + * printable, effectively split the range into two parts: * 1) the portion before the first such printable, * 2) the rest * and output them separately. */ @@ -19261,18 +19301,18 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) temp_end = end + 1; } - /* Output the first part of the split range, the part that - * doesn't have printables, with no looking for literals - * (otherwise we would infinitely recurse) */ + /* Output the first part of the split range: the part that + * doesn't have printables, with the parameter set to not look + * for literals (otherwise we would infinitely recurse) */ put_range(sv, start, temp_end - 1, FALSE); /* The 2nd part of the range (if any) starts here. */ start = temp_end; - /* We continue instead of dropping down because even if the 2nd - * part is non-empty, it could be so short that we want to - * output it specially, as tested for at the top of this loop. - * */ + /* We do a continue, instead of dropping down, because even if + * the 2nd part is non-empty, it could be so short that we want + * to output it as individual characters, as tested for at the + * top of this loop. */ continue; } @@ -19337,7 +19377,8 @@ S_put_range(pTHX_ SV *sv, UV start, const UV end, const bool allow_literals) temp_end--; } - /* And separately output the range that doesn't have mnemonics */ + /* And separately output the interior range that doesn't start or + * end with mnemonics */ put_range(sv, start, temp_end, FALSE); /* Then output the mnemonic trailing controls */ @@ -19374,7 +19415,8 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv, char *bitmap, SV** bitmap_invlist) /* Appends to 'sv' a displayable version of the innards of the bracketed * character class whose bitmap is 'bitmap'; Returns 'TRUE' if it actually * output anything, and bitmap_invlist, if not NULL, will point to an - * inversion list of what is in the bit map */ + * inversion list of what is in the bit map. It must be freed by the + * caller. */ int i; UV start, end; @@ -19412,11 +19454,12 @@ S_put_charclass_bitmap_innards(pTHX_ SV *sv, char *bitmap, SV** bitmap_invlist) /* Generally, it is more readable if printable characters are output as * literals, but if a range (nearly) spans all of them, it's best to output * it as a single range. This code will use a single range if all but 2 - * printables are in it */ + * ASCII printables are in it */ invlist_iterinit(invlist); while (invlist_iternext(invlist, &start, &end)) { - /* If range starts beyond final printable, it doesn't have any in it */ + /* If the range starts beyond the final printable, it doesn't have any + * in it */ if (start > MAX_PRINT_A) { break; } diff --git a/regcomp.h b/regcomp.h index 07e098a..c08888e 100644 --- a/regcomp.h +++ b/regcomp.h @@ -1069,22 +1069,25 @@ re.pm, especially to the documentation. PERL_UNUSED_VAR(re_debug_flags); GET_RE_DEBUG_FLAGS; #define RE_PV_COLOR_DECL(rpv,rlen,isuni,dsv,pv,l,m,c1,c2) \ - const char * const rpv = \ - pv_pretty((dsv), (pv), (l), (m), \ - PL_colors[(c1)],PL_colors[(c2)], \ + const char * const rpv = \ + pv_pretty((dsv), (pv), (l), \ + (PL_dump_re_max_len) ? PL_dump_re_max_len : (m), \ + PL_colors[(c1)],PL_colors[(c2)], \ PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) ); \ const int rlen = SvCUR(dsv) -#define RE_SV_ESCAPE(rpv,isuni,dsv,sv,m) \ - const char * const rpv = \ - pv_pretty((dsv), (SvPV_nolen_const(sv)), (SvCUR(sv)), (m), \ - PL_colors[(c1)],PL_colors[(c2)], \ +#define RE_SV_ESCAPE(rpv,isuni,dsv,sv,m) \ + const char * const rpv = \ + pv_pretty((dsv), (SvPV_nolen_const(sv)), (SvCUR(sv)), \ + (PL_dump_re_max_len) ? PL_dump_re_max_len : (m), \ + PL_colors[(c1)],PL_colors[(c2)], \ PERL_PV_ESCAPE_RE|PERL_PV_ESCAPE_NONASCII |((isuni) ? PERL_PV_ESCAPE_UNI : 0) ) #define RE_PV_QUOTED_DECL(rpv,isuni,dsv,pv,l,m) \ const char * const rpv = \ - pv_pretty((dsv), (pv), (l), (m), \ - PL_colors[0], PL_colors[1], \ + pv_pretty((dsv), (pv), (l), \ + (PL_dump_re_max_len) ? PL_dump_re_max_len : (m), \ + PL_colors[0], PL_colors[1], \ ( PERL_PV_PRETTY_QUOTE | PERL_PV_ESCAPE_RE | PERL_PV_ESCAPE_NONASCII | PERL_PV_PRETTY_ELLIPSES | \ ((isuni) ? PERL_PV_ESCAPE_UNI : 0)) \ ) -- Perl5 Master Repository
