diff options
author | Ilya Zakharevich <ilya@math.berkeley.edu> | 1998-11-27 10:22:19 -0500 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1998-11-28 19:21:17 +0000 |
commit | d88dccdfb395b1157f084b2065b4dae06e68381b (patch) | |
tree | 376bfec25d3d6d3556bba5feabb29288ccd4c921 /regcomp.c | |
parent | 6a65c6a0721422f3dbac9c301f2d6e8b04b74975 (diff) | |
download | perl-d88dccdfb395b1157f084b2065b4dae06e68381b.tar.gz |
regcolors
Message-Id: <199811272022.PAA17874@monk.mps.ohio-state.edu>
p4raw-id: //depot/perl@2370
Diffstat (limited to 'regcomp.c')
-rw-r--r-- | regcomp.c | 56 |
1 files changed, 31 insertions, 25 deletions
@@ -39,6 +39,7 @@ # define Perl_pregfree my_regfree # define Perl_regnext my_regnext # define Perl_save_re_context my_save_re_context +# define Perl_reginitcolors my_reginitcolors #endif /*SUPPRESS 112*/ @@ -759,6 +760,31 @@ add_data(I32 n, char *s) return PL_regcomp_rx->data->count - n; } +void +reginitcolors(void) +{ + dTHR; + int i = 0; + char *s = PerlEnv_getenv("PERL_RE_COLORS"); + + if (s) { + PL_colors[0] = s = savepv(s); + while (++i < 6) { + s = strchr(s, '\t'); + if (s) { + *s = '\0'; + PL_colors[i] = ++s; + } + else + PL_colors[i] = ""; + } + } else { + while (i < 6) + PL_colors[i++] = ""; + } + PL_colorset = 1; +} + /* - pregcomp - compile a regular expression into internal code * @@ -799,31 +825,11 @@ pregcomp(char *exp, char *xend, PMOP *pm) PL_regprecomp = savepvn(exp, xend - exp); DEBUG_r( - if (!PL_colorset) { - int i = 0; - char *s = PerlEnv_getenv("PERL_RE_COLORS"); - - if (s) { - PL_colors[0] = s = savepv(s); - while (++i < 6) { - s = strchr(s, '\t'); - if (s) { - *s = '\0'; - PL_colors[i] = ++s; - } - else - PL_colors[i] = ""; - } - } else { - while (i < 6) - PL_colors[i++] = ""; - } - PL_colorset = 1; - } - ); - DEBUG_r(PerlIO_printf(Perl_debug_log, "%sCompiling%s RE `%s%*s%s'\n", - PL_colors[4],PL_colors[5],PL_colors[0], - xend - exp, PL_regprecomp, PL_colors[1])); + if (!PL_colorset) + reginitcolors(); + PerlIO_printf(Perl_debug_log, "%sCompiling%s RE `%s%*s%s'\n", + PL_colors[4],PL_colors[5],PL_colors[0], + xend - exp, PL_regprecomp, PL_colors[1])); PL_regflags = pm->op_pmflags; PL_regsawback = 0; |