From: Andy Lester Date: Mon, 15 May 2006 08:54:24 +0000 (-0500) Subject: Refactoring reghops X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=0ce71af7a9fc04f228d597a47acc6b50ded81784;p=p5sagit%2Fp5-mst-13.2.git Refactoring reghops Message-ID: <20060515135424.GA31585@petdance.com> p4raw-id: //depot/perl@28206 --- diff --git a/embed.fnc b/embed.fnc index 860f3f4..dac19c7 100644 --- a/embed.fnc +++ b/embed.fnc @@ -1329,8 +1329,8 @@ ERs |bool |reginclass |NULLOK const regexp *prog|NN const regnode *n|NN const U8 |bool do_utf8sv_is_utf8 Es |CHECKPOINT|regcppush |I32 parenfloor Es |char* |regcppop |NN const regexp *rex -ERsn |U8* |reghop3 |NN U8 *pos|I32 off|NN U8 *lim -ERsn |U8* |reghopmaybe3 |NN U8 *pos|I32 off|NN U8 *lim +ERsn |U8* |reghop3 |NN U8 *pos|I32 off|NN const U8 *lim +ERsn |U8* |reghopmaybe3 |NN U8 *pos|I32 off|NN const U8 *lim ERs |char* |find_byclass |NN regexp * prog|NN const regnode *c|NN char *s|NN const char *strend|NULLOK const regmatch_info *reginfo Es |void |to_utf8_substr |NN regexp * prog Es |void |to_byte_substr |NN regexp * prog diff --git a/proto.h b/proto.h index cfca4d8..0d8d7b1 100644 --- a/proto.h +++ b/proto.h @@ -3648,12 +3648,12 @@ STATIC CHECKPOINT S_regcppush(pTHX_ I32 parenfloor); STATIC char* S_regcppop(pTHX_ const regexp *rex) __attribute__nonnull__(pTHX_1); -STATIC U8* S_reghop3(U8 *pos, I32 off, U8 *lim) +STATIC U8* S_reghop3(U8 *pos, I32 off, const U8 *lim) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(3); -STATIC U8* S_reghopmaybe3(U8 *pos, I32 off, U8 *lim) +STATIC U8* S_reghopmaybe3(U8 *pos, I32 off, const U8 *lim) __attribute__warn_unused_result__ __attribute__nonnull__(1) __attribute__nonnull__(3); diff --git a/regexec.c b/regexec.c index 94ad06f..f765024 100644 --- a/regexec.c +++ b/regexec.c @@ -110,7 +110,6 @@ : (U8*)NULL) \ ) -#define reghopmaybe3_c(pos,off,lim) ((char*)reghopmaybe3((U8*)pos, off, (U8*)lim)) #define HOP3(pos,off,lim) (PL_reg_match_utf8 ? reghop3((U8*)pos, off, (U8*)lim) : (U8*)(pos + off)) #define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim)) @@ -572,7 +571,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, t = s - prog->check_offset_max; if (s - strpos > prog->check_offset_max /* signed-corrected t > strpos */ && (!do_utf8 - || ((t = reghopmaybe3_c(s, -(prog->check_offset_max), strpos)) + || ((t = (char*)reghopmaybe3((U8*)s, -(prog->check_offset_max), (U8*)strpos)) && t > strpos))) NOOP; else @@ -692,7 +691,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, t = s - prog->check_offset_max; if (s - strpos > prog->check_offset_max /* signed-corrected t > strpos */ && (!do_utf8 - || ((t = reghopmaybe3_c(s, -prog->check_offset_max, strpos)) + || ((t = (char*)reghopmaybe3((U8*)s, -prog->check_offset_max, (U8*)strpos)) && t > strpos))) { /* Fixed substring is found far enough so that the match cannot start at strpos. */ @@ -5102,7 +5101,7 @@ S_reginclass(pTHX_ const regexp *prog, register const regnode *n, register const } STATIC U8 * -S_reghop3(U8 *s, I32 off, U8* lim) +S_reghop3(U8 *s, I32 off, const U8* lim) { dVAR; if (off >= 0) { @@ -5127,7 +5126,7 @@ S_reghop3(U8 *s, I32 off, U8* lim) } STATIC U8 * -S_reghopmaybe3(U8* s, I32 off, U8* lim) +S_reghopmaybe3(U8* s, I32 off, const U8* lim) { dVAR; if (off >= 0) {