From b99ea430ce1f7215248ce67a7471367dbc1380e0 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Tue, 24 Jul 2012 20:28:48 -0600 Subject: [PATCH] regcomp.c: Revise debugging function I use this function for debugging, but it is normally commented out. This commit adds an entry to embed.fnc for it that can quickly be uncommented, and makes some revisions to the function itself. --- embed.fnc | 1 + regcomp.c | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/embed.fnc b/embed.fnc index 814495f..8bc67fe 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1424,6 +1424,7 @@ EMiR |bool |_invlist_contains_cp|NN SV* const invlist|const UV cp EXpMR |IV |_invlist_search |NN SV* const invlist|const UV cp EXMpR |SV* |_get_swash_invlist|NN SV* const swash EXMpR |HV* |_swash_inversion_hash |NN SV* const swash +: Not used currently: Mp |void |_invlist_dump |NN SV* const invlist|NN const char * const header #endif Ap |void |taint_env Ap |void |taint_proper |NULLOK const char* f|NN const char *const s diff --git a/regcomp.c b/regcomp.c index 0c62cb0..6d868af 100644 --- a/regcomp.c +++ b/regcomp.c @@ -8252,15 +8252,17 @@ Perl__invlist_contents(pTHX_ SV* const invlist) } #endif -#if 0 +#ifdef PERL_ARGS_ASSERT__INVLIST_DUMP void -S_invlist_dump(pTHX_ SV* const invlist, const char * const header) +Perl__invlist_dump(pTHX_ SV* const invlist, const char * const header) { /* Dumps out the ranges in an inversion list. The string 'header' * if present is output on a line before the first range */ UV start, end; + PERL_ARGS_ASSERT__INVLIST_DUMP; + if (header && strlen(header)) { PerlIO_printf(Perl_debug_log, "%s\n", header); } @@ -8269,8 +8271,12 @@ S_invlist_dump(pTHX_ SV* const invlist, const char * const header) if (end == UV_MAX) { PerlIO_printf(Perl_debug_log, "0x%04"UVXf" .. INFINITY\n", start); } + else if (end != start) { + PerlIO_printf(Perl_debug_log, "0x%04"UVXf" .. 0x%04"UVXf"\n", + start, end); + } else { - PerlIO_printf(Perl_debug_log, "0x%04"UVXf" .. 0x%04"UVXf"\n", start, end); + PerlIO_printf(Perl_debug_log, "0x%04"UVXf"\n", start); } } } -- 2.7.4