4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-02-21 00:07:36 +08:00

Cygwin: regex: fix type and use macro to define equivalence class marking

tre_ctype_t needs to be able to keep the equivalence marking bit.
Define the bit as macro.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2023-03-09 11:06:44 +01:00
parent 702dfcc8da
commit 4449f3a11d
3 changed files with 7 additions and 4 deletions

View File

@ -609,7 +609,7 @@ static reg_errcode_t parse_bracket_terms(tre_parse_ctx_t *ctx, const char *s, st
} else if (equiv && neg->negate) {
if (neg->len >= MAX_NEG_CLASSES)
return REG_ESPACE;
neg->a[neg->len++] = equiv | 0x80000000;
neg->a[neg->len++] = equiv | ASSERT_EQUIV_MATCH;
} else {
tre_literal_t *lit = tre_new_lit(ls);
if (!lit)

View File

@ -124,8 +124,8 @@ static int
tre_neg_char_classes_match(tre_ctype_t *classes, tre_cint_t wc, int icase)
{
while (*classes != (tre_ctype_t)0) {
if (*classes & 0x80000000) {
if (is_unicode_equiv(*classes & ~0x80000000, wc))
if (*classes & ASSERT_EQUIV_MATCH) {
if (is_unicode_equiv(*classes & ~(ASSERT_EQUIV_MATCH), wc))
return 1;
} else if ((!icase && tre_isctype(wc, *classes))
|| (icase && (tre_isctype(tre_toupper(wc), *classes)

View File

@ -71,7 +71,7 @@ typedef wint_t tre_cint_t;
#define tre_strlen wcslen
/* Use system provided iswctype() and wctype(). */
typedef wctype_t tre_ctype_t;
typedef wint_t tre_ctype_t; /* wint_t required by equivalence class */
#define tre_isctype iswctype
#define tre_ctype wctype
@ -130,6 +130,9 @@ struct tnfa_transition {
#define ASSERT_EQUIV_CLASS 512 /* Equivalence class in `equiv'. */
#define ASSERT_LAST 512
#define ASSERT_EQUIV_MATCH 0x80000000 /* For marking equivalence class in
`neg_classes' */
/* Tag directions. */
typedef enum {
TRE_TAG_MINIMIZE = 0,