diff options
author | Karl Williamson <khw@cpan.org> | 2020-03-04 20:52:57 -0700 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2020-03-18 17:38:19 -0600 |
commit | 1fe1d354d323db2d8a59f107855fc1f71ddc6ab5 (patch) | |
tree | f6fdac4fc9044463f797296538fc8b81b81001e5 /regcomp.h | |
parent | 3f5ee3fa4a562ad9669511d3628e3b133a048a1c (diff) | |
download | perl-1fe1d354d323db2d8a59f107855fc1f71ddc6ab5.tar.gz |
regcomp.h: Add macro
This macro is for files outside of regcomp.c/regexec.c (and
re_comp.c/re_exec.c) to have access to the re.pm Debug options.
Right now pp_match could benefit from this.
Diffstat (limited to 'regcomp.h')
-rw-r--r-- | regcomp.h | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -1101,8 +1101,24 @@ re.pm, especially to the documentation. if (DEBUG_v_TEST || RE_DEBUG_FLAG(RE_DEBUG_EXTRA_DUMP_PRE_OPTIMIZE)) x ) /* initialization */ +/* Get the debug flags for code not in regcomp.c nor regexec.c. This doesn't + * initialize the variable if it isn't already there, instead it just assumes + * the flags are 0 */ +#define DECLARE_AND_GET_RE_DEBUG_FLAGS_NON_REGEX \ + volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ + STMT_START { \ + SV * re_debug_flags_sv = NULL; \ + /* get_sv() can return NULL during global destruction. */ \ + re_debug_flags_sv = PL_curcop ? get_sv(RE_DEBUG_FLAGS, GV_ADD) : NULL; \ + if (re_debug_flags_sv && SvIOK(re_debug_flags_sv)) \ + re_debug_flags=SvIV(re_debug_flags_sv); \ + } STMT_END + + #ifdef DEBUGGING +/* For use in regcomp.c and regexec.c, Get the debug flags, and initialize to + * the defaults if not done already */ #define DECLARE_AND_GET_RE_DEBUG_FLAGS \ volatile IV re_debug_flags = 0; PERL_UNUSED_VAR(re_debug_flags); \ STMT_START { \ |