diff options
author | Yves Orton <demerphq@gmail.com> | 2012-10-21 15:04:47 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2012-10-26 12:22:51 +0200 |
commit | 6b54ddc5f039cda5c3fd0fa36516955199bdb957 (patch) | |
tree | d0183f70543462227707a3d1b874fce1c6c9f7ba /regexec.c | |
parent | 9493bd02dc3e10bea1209cd27f5c6a7603b1f521 (diff) | |
download | perl-6b54ddc5f039cda5c3fd0fa36516955199bdb957.tar.gz |
fix a compile warning and refactor some diagnostics in regexec.c
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 25 |
1 files changed, 10 insertions, 15 deletions
@@ -42,6 +42,11 @@ const char* const non_utf8_target_but_utf8_required = "Can't match, because target string needs to be in UTF-8\n"; +#define NON_UTF8_TARGET_BUT_UTF8_REQUIRED(target) STMT_START { \ + DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, "%s", non_utf8_target_but_utf8_required));\ + goto target; \ +} STMT_END + /* * pregcomp and pregexec -- regsub and regerror are not used in perl * @@ -639,9 +644,7 @@ Perl_re_intuit_start(pTHX_ REGEXP * const rx, SV *sv, char *strpos, } else { if (!prog->check_substr && prog->check_utf8) { if (! to_byte_substr(prog)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - non_utf8_target_but_utf8_required)); - goto fail; + NON_UTF8_TARGET_BUT_UTF8_REQUIRED(fail); } } check = prog->check_substr; @@ -2345,9 +2348,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre else { if (! prog->anchored_substr) { if (! to_byte_substr(prog)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - non_utf8_target_but_utf8_required)); - goto phooey; + NON_UTF8_TARGET_BUT_UTF8_REQUIRED(phooey); } } ch = SvPVX_const(prog->anchored_substr)[0]; @@ -2388,9 +2389,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre else { if (! prog->anchored_substr) { if (! to_byte_substr(prog)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - non_utf8_target_but_utf8_required)); - goto phooey; + NON_UTF8_TARGET_BUT_UTF8_REQUIRED(phooey); } } must = prog->anchored_substr; @@ -2406,9 +2405,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre else { if (! prog->float_substr) { if (! to_byte_substr(prog)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - non_utf8_target_but_utf8_required)); - goto phooey; + NON_UTF8_TARGET_BUT_UTF8_REQUIRED(phooey); } } must = prog->float_substr; @@ -2519,9 +2516,7 @@ Perl_regexec_flags(pTHX_ REGEXP * const rx, char *stringarg, register char *stre else { if (! prog->float_substr) { if (! to_byte_substr(prog)) { - DEBUG_EXECUTE_r(PerlIO_printf(Perl_debug_log, - non_utf8_target_but_utf8_required)); - goto phooey; + NON_UTF8_TARGET_BUT_UTF8_REQUIRED(phooey); } } float_real = prog->float_substr; |