From eb1fcdf5d1058f4fbdf3a2661573dd7e4d3976f3 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 26 Jun 2026 23:14:44 +0200 Subject: allow raw (ASCII) matching via REG_RAW flag, so we no longer need a compile-time flag You no longer need to build two libraries just for supporting raw/ASCII and UTF-8 patterns. This makes using the library a lot easier and reduces the total binary size. Since strings are always `unsigned char *` now internally and the raw vs. UTF-8 decision is important only in a few select places, it would make no sense to use meta-programming techniques. The test suite has been extended and is now fixed for cases with embedded non-printable characters. --- regex.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'regex.h') diff --git a/regex.h b/regex.h index 1e32b18..c15d005 100644 --- a/regex.h +++ b/regex.h @@ -119,16 +119,9 @@ extern "C" { # undef regerror # define regfree re_free # define regerror re_error -// FIXME # undef __REG_WIDE_T # define __REG_WIDE_T unsigned char -# undef __REG_WIDE_COMPILE -# define __REG_WIDE_COMPILE re_ucomp -# undef __REG_WIDE_EXEC -# define __REG_WIDE_EXEC re_uexec -# ifndef REGEX_UTF8 -# undef __REG_NOCHAR -# endif +# undef __REG_NOCHAR #endif /* @@ -237,6 +230,7 @@ typedef struct { #define REG_DUMP 004000 /* none of your business :-) */ #define REG_FAKE 010000 /* none of your business :-) */ #define REG_PROGRESS 020000 /* none of your business :-) */ +#define REG_RAW 040000 /* pattern and subject are raw ASCII (also an execution flag) */ /* * execution -- cgit v1.2.3