summaryrefslogtreecommitdiff
path: root/lib/regex_internal.h
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-11-23 17:34:45 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2021-11-24 09:35:15 -0800
commitfae096d8028a4a3c855a3f11ee22e3e726e853bb (patch)
tree01b1ebac168ca60ded611c0b81101a00cb4caba9 /lib/regex_internal.h
parent1a268176fbb184e393c98575e61fe692264c7d91 (diff)
downloadgnulib-fae096d8028a4a3c855a3f11ee22e3e726e853bb.tar.gz
regex: assume RE_ENABLE_I18N
These days there is no longer any need to port to platforms lacking iswctype etc., since Gnulib now has substitutes. * config/srclist.txt: Comment out regex_internal.c and regex_internal.h for now, since they no longer match glibc. The intent is to merge them again soon. * lib/regex_internal.h (RE_ENABLE_I18N): Remove. All uses changed to assume that RE_ENABLE_I18N is 1. * modules/regex (Depends-on): Add iswctype.
Diffstat (limited to 'lib/regex_internal.h')
-rw-r--r--lib/regex_internal.h44
1 files changed, 14 insertions, 30 deletions
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index 1245e782ff..b1bc2ee62f 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -116,10 +116,6 @@
# define gettext_noop(String) String
#endif
-#if (defined MB_CUR_MAX && HAVE_WCTYPE_H && HAVE_ISWCTYPE) || _LIBC
-# define RE_ENABLE_I18N
-#endif
-
/* Number of ASCII characters. */
#define ASCII_CHARS 0x80
@@ -246,10 +242,8 @@ typedef enum
SIMPLE_BRACKET = 3,
OP_BACK_REF = 4,
OP_PERIOD = 5,
-#ifdef RE_ENABLE_I18N
COMPLEX_BRACKET = 6,
OP_UTF8_PERIOD = 7,
-#endif /* RE_ENABLE_I18N */
/* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
when the debugger shows values of this enum type. */
@@ -287,30 +281,29 @@ typedef enum
} re_token_type_t;
-#ifdef RE_ENABLE_I18N
typedef struct
{
/* Multibyte characters. */
wchar_t *mbchars;
+#ifdef _LIBC
/* Collating symbols. */
-# ifdef _LIBC
int32_t *coll_syms;
-# endif
+#endif
+#ifdef _LIBC
/* Equivalence classes. */
-# ifdef _LIBC
int32_t *equiv_classes;
-# endif
+#endif
/* Range expressions. */
-# ifdef _LIBC
+#ifdef _LIBC
uint32_t *range_starts;
uint32_t *range_ends;
-# else /* not _LIBC */
+#else
wchar_t *range_starts;
wchar_t *range_ends;
-# endif /* not _LIBC */
+#endif
/* Character classes. */
wctype_t *char_classes;
@@ -333,7 +326,6 @@ typedef struct
/* # of character classes. */
Idx nchar_classes;
} re_charset_t;
-#endif /* RE_ENABLE_I18N */
typedef struct
{
@@ -341,9 +333,7 @@ typedef struct
{
unsigned char c; /* for CHARACTER */
re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */
-#ifdef RE_ENABLE_I18N
re_charset_t *mbcset; /* for COMPLEX_BRACKET */
-#endif /* RE_ENABLE_I18N */
Idx idx; /* for BACK_REF */
re_context_type ctx_type; /* for ANCHOR */
} opr;
@@ -355,12 +345,10 @@ typedef struct
unsigned int constraint : 10; /* context constraint */
unsigned int duplicated : 1;
unsigned int opt_subexp : 1;
-#ifdef RE_ENABLE_I18N
unsigned int accept_mb : 1;
/* These 2 bits can be moved into the union if needed (e.g. if running out
of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */
unsigned int mb_partial : 1;
-#endif
unsigned int word_char : 1;
} re_token_t;
@@ -375,12 +363,10 @@ struct re_string_t
REG_ICASE, upper cases of the string are stored, otherwise MBS points
the same address that RAW_MBS points. */
unsigned char *mbs;
-#ifdef RE_ENABLE_I18N
/* Store the wide character string which is corresponding to MBS. */
wint_t *wcs;
Idx *offsets;
mbstate_t cur_state;
-#endif
/* Index in RAW_MBS. Each character mbs[i] corresponds to
raw_mbs[raw_mbs_idx + i]. */
Idx raw_mbs_idx;
@@ -779,7 +765,6 @@ bitset_mask (bitset_t dest, const bitset_t src)
dest[bitset_i] &= src[bitset_i];
}
-#ifdef RE_ENABLE_I18N
/* Functions for re_string. */
static int
__attribute__ ((pure, unused))
@@ -803,15 +788,15 @@ re_string_wchar_at (const re_string_t *pstr, Idx idx)
return (wint_t) pstr->wcs[idx];
}
-# ifdef _LIBC
-# include <locale/weight.h>
-# endif
+#ifdef _LIBC
+# include <locale/weight.h>
+#endif
static int
__attribute__ ((pure, unused))
re_string_elem_size_at (const re_string_t *pstr, Idx idx)
{
-# ifdef _LIBC
+#ifdef _LIBC
const unsigned char *p, *extra;
const int32_t *table, *indirect;
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
@@ -827,11 +812,10 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
findidx (table, indirect, extra, &p, pstr->len - idx);
return p - pstr->mbs - idx;
}
- else
-# endif /* _LIBC */
- return 1;
+#endif /* _LIBC */
+
+ return 1;
}
-#endif /* RE_ENABLE_I18N */
#ifdef _LIBC
# if __GNUC__ >= 7