readability

This commit is contained in:
anon 2023-09-26 11:08:24 +02:00
parent 7e81ea3f01
commit b3e21c3e29

View File

@ -490,6 +490,11 @@ regex_t * regex_compile(const char * const pattern) {
char whitelist[64];
char blacklist[64];
static const int REGEX_PREVERSABLE_FLAGS = IS_AT_THE_BEGINNING
| FORCE_START_OF_STRING
| DO_FORBID_START_OF_STRING
;
compiler_state cs = {
.flags = IS_AT_THE_BEGINNING,
.state = JEGER_INIT_STATE,
@ -502,7 +507,7 @@ regex_t * regex_compile(const char * const pattern) {
// Reset the compiler
whitelist[0] = '\0';
blacklist[0] = '\0';
cs.flags &= (IS_AT_THE_BEGINNING | FORCE_START_OF_STRING);
cs.flags &= REGEX_PREVERSABLE_FLAGS;
cs.width = 1;
cs.match_width = 1;
@ -657,6 +662,7 @@ regex_t * regex_compile(const char * const pattern) {
++cs.state;
}
// Purge SOS flag
cs.flags &= (~IS_AT_THE_BEGINNING);
}