Tidy ACROSSCHAR macro to take same form as FORWARDCHAR and BACKCHAR.

This commit is contained in:
Philip.Hazel 2018-01-01 15:13:24 +00:00
parent 4048606896
commit 85f8ecba58
3 changed files with 17 additions and 19 deletions

View File

@ -508,7 +508,8 @@ if (*this_start_code == OP_ASSERTBACK || *this_start_code == OP_ASSERTBACK_NOT)
{ {
if (current_subject <= start_subject) break; if (current_subject <= start_subject) break;
current_subject--; current_subject--;
ACROSSCHAR(current_subject > start_subject, *current_subject, current_subject--); ACROSSCHAR(current_subject > start_subject, current_subject,
current_subject--);
} }
} }
else else
@ -3380,7 +3381,7 @@ for (;;)
while (t < end_subject && !IS_NEWLINE(t)) while (t < end_subject && !IS_NEWLINE(t))
{ {
t++; t++;
ACROSSCHAR(t < end_subject, *t, t++); ACROSSCHAR(t < end_subject, t, t++);
} }
} }
else else
@ -3485,8 +3486,7 @@ for (;;)
while (start_match < end_subject && !WAS_NEWLINE(start_match)) while (start_match < end_subject && !WAS_NEWLINE(start_match))
{ {
start_match++; start_match++;
ACROSSCHAR(start_match < end_subject, *start_match, ACROSSCHAR(start_match < end_subject, start_match, start_match++);
start_match++);
} }
} }
else else
@ -3648,8 +3648,7 @@ for (;;)
#ifdef SUPPORT_UNICODE #ifdef SUPPORT_UNICODE
if (utf) if (utf)
{ {
ACROSSCHAR(start_match < end_subject, *start_match, ACROSSCHAR(start_match < end_subject, start_match, start_match++);
start_match++);
} }
#endif #endif
if (start_match > end_subject) break; if (start_match > end_subject) break;

View File

@ -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. */ /* Same as above, but it allows a fully customizable form. */
#define ACROSSCHAR(condition, eptr, action) \ #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. */ /* 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. */ /* Same as above, but it allows a fully customizable form. */
#define ACROSSCHAR(condition, eptr, action) \ #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. */ /* Deposit a character into memory, returning the number of code units. */

View File

@ -879,7 +879,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
} }
Feptr++; Feptr++;
#ifdef SUPPORT_UNICODE #ifdef SUPPORT_UNICODE
if (utf) ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); if (utf) ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
#endif #endif
Fecode++; Fecode++;
break; break;
@ -2776,7 +2776,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
} }
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
break; break;
@ -2789,7 +2789,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
RRETURN(MATCH_NOMATCH); RRETURN(MATCH_NOMATCH);
} }
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
break; break;
@ -2943,7 +2943,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
if (cc < 128 && (mb->ctypes[cc] & ctype_space) != 0) if (cc < 128 && (mb->ctypes[cc] & ctype_space) != 0)
RRETURN(MATCH_NOMATCH); RRETURN(MATCH_NOMATCH);
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
break; break;
@ -2977,7 +2977,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
if (cc < 128 && (mb->ctypes[cc] & ctype_word) != 0) if (cc < 128 && (mb->ctypes[cc] & ctype_word) != 0)
RRETURN(MATCH_NOMATCH); RRETURN(MATCH_NOMATCH);
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
break; break;
@ -4110,7 +4110,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
if (mb->partial > 1) return PCRE2_ERROR_PARTIAL; if (mb->partial > 1) return PCRE2_ERROR_PARTIAL;
} }
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
break; break;
@ -4125,7 +4125,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
break; break;
} }
Feptr++; Feptr++;
ACROSSCHAR(Feptr < mb->end_subject, *Feptr, Feptr++); ACROSSCHAR(Feptr < mb->end_subject, Feptr, Feptr++);
} }
} }
else else
@ -6378,7 +6378,7 @@ for(;;)
while (t < end_subject && !IS_NEWLINE(t)) while (t < end_subject && !IS_NEWLINE(t))
{ {
t++; t++;
ACROSSCHAR(t < end_subject, *t, t++); ACROSSCHAR(t < end_subject, t, t++);
} }
} }
else else
@ -6489,8 +6489,7 @@ for(;;)
while (start_match < end_subject && !WAS_NEWLINE(start_match)) while (start_match < end_subject && !WAS_NEWLINE(start_match))
{ {
start_match++; start_match++;
ACROSSCHAR(start_match < end_subject, *start_match, ACROSSCHAR(start_match < end_subject, start_match, start_match++);
start_match++);
} }
} }
else else
@ -6709,7 +6708,7 @@ for(;;)
new_start_match = start_match + 1; new_start_match = start_match + 1;
#ifdef SUPPORT_UNICODE #ifdef SUPPORT_UNICODE
if (utf) if (utf)
ACROSSCHAR(new_start_match < end_subject, *new_start_match, ACROSSCHAR(new_start_match < end_subject, new_start_match,
new_start_match++); new_start_match++);
#endif #endif
break; break;