From 435e896a140f2b41d85ad2b857136960971d9a3f Mon Sep 17 00:00:00 2001 From: ph10 Date: Mon, 1 Jan 2018 15:13:24 +0000 Subject: [PATCH] Tidy ACROSSCHAR macro to take same form as FORWARDCHAR and BACKCHAR. --- src/pcre2_dfa_match.c | 11 +++++------ src/pcre2_intmodedep.h | 4 ++-- src/pcre2_match.c | 21 ++++++++++----------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c index 965386e..6888370 100644 --- a/src/pcre2_dfa_match.c +++ b/src/pcre2_dfa_match.c @@ -508,7 +508,8 @@ if (*this_start_code == OP_ASSERTBACK || *this_start_code == OP_ASSERTBACK_NOT) { if (current_subject <= start_subject) break; current_subject--; - ACROSSCHAR(current_subject > start_subject, *current_subject, current_subject--); + ACROSSCHAR(current_subject > start_subject, current_subject, + current_subject--); } } else @@ -3380,7 +3381,7 @@ for (;;) while (t < end_subject && !IS_NEWLINE(t)) { t++; - ACROSSCHAR(t < end_subject, *t, t++); + ACROSSCHAR(t < end_subject, t, t++); } } else @@ -3485,8 +3486,7 @@ for (;;) while (start_match < end_subject && !WAS_NEWLINE(start_match)) { start_match++; - ACROSSCHAR(start_match < end_subject, *start_match, - start_match++); + ACROSSCHAR(start_match < end_subject, start_match, start_match++); } } else @@ -3648,8 +3648,7 @@ for (;;) #ifdef SUPPORT_UNICODE if (utf) { - ACROSSCHAR(start_match < end_subject, *start_match, - start_match++); + ACROSSCHAR(start_match < end_subject, start_match, start_match++); } #endif if (start_match > end_subject) break; diff --git a/src/pcre2_intmodedep.h b/src/pcre2_intmodedep.h index 7305280..55bd931 100644 --- a/src/pcre2_intmodedep.h +++ b/src/pcre2_intmodedep.h @@ -351,7 +351,7 @@ because almost all calls are already within a block of UTF-8 only code. */ /* Same as above, but it allows a fully customizable form. */ #define ACROSSCHAR(condition, eptr, action) \ - while((condition) && ((eptr) & 0xc0u) == 0x80u) action + while((condition) && ((*eptr) & 0xc0u) == 0x80u) action /* Deposit a character into memory, returning the number of code units. */ @@ -457,7 +457,7 @@ code. */ /* Same as above, but it allows a fully customizable form. */ #define ACROSSCHAR(condition, eptr, action) \ - if ((condition) && ((eptr) & 0xfc00u) == 0xdc00u) action + if ((condition) && ((*eptr) & 0xfc00u) == 0xdc00u) action /* Deposit a character into memory, returning the number of code units. */ diff --git a/src/pcre2_match.c b/src/pcre2_match.c index 34ce747..79cc93f 100644 --- a/src/pcre2_match.c +++ b/src/pcre2_match.c @@ -879,7 +879,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); } Feptr++; #ifdef SUPPORT_UNICODE - if (utf) ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + if (utf) ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); #endif Fecode++; break; @@ -2776,7 +2776,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; } Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } break; @@ -2789,7 +2789,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); RRETURN(MATCH_NOMATCH); } Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } break; @@ -2943,7 +2943,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); if (cc < 128 && (mb->ctypes[cc] & ctype_space) != 0) RRETURN(MATCH_NOMATCH); Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } break; @@ -2977,7 +2977,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); if (cc < 128 && (mb->ctypes[cc] & ctype_word) != 0) RRETURN(MATCH_NOMATCH); Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } break; @@ -4110,7 +4110,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; } Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } break; @@ -4125,7 +4125,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode); break; } Feptr++; - ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); + ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++); } } else @@ -6378,7 +6378,7 @@ for(;;) while (t < end_subject && !IS_NEWLINE(t)) { t++; - ACROSSCHAR(t < end_subject, *t, t++); + ACROSSCHAR(t < end_subject, t, t++); } } else @@ -6489,8 +6489,7 @@ for(;;) while (start_match < end_subject && !WAS_NEWLINE(start_match)) { start_match++; - ACROSSCHAR(start_match < end_subject, *start_match, - start_match++); + ACROSSCHAR(start_match < end_subject, start_match, start_match++); } } else @@ -6709,7 +6708,7 @@ for(;;) new_start_match = start_match + 1; #ifdef SUPPORT_UNICODE if (utf) - ACROSSCHAR(new_start_match < end_subject, *new_start_match, + ACROSSCHAR(new_start_match < end_subject, new_start_match, new_start_match++); #endif break;