From 990b2375ebeb985d6846eb538a72c3478f460bd4 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 23 Mar 2000 04:36:34 +0000 Subject: [PATCH] (enum syntaxcode): Provide default for non-Emacs. (re_compile_fastmap, re_match_2_internal): Undo Dave's previous fix. --- src/ChangeLog | 5 +++++ src/regex.c | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 33b82214e51..10fbfe0056a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2000-03-22 Stefan Monnier + + * regex.c (enum syntaxcode): Provide default for non-Emacs. + (re_compile_fastmap, re_match_2_internal): Undo Dave's previous fix. + 2000-03-22 Jason Rumney * w32menu.c (single_submenu): Set help string to NULL if none. diff --git a/src/regex.c b/src/regex.c index d1d18c36bd3..227a52b46e8 100644 --- a/src/regex.c +++ b/src/regex.c @@ -22,7 +22,6 @@ /* TODO: - detect nasty infinite loops like "\\(\\)+?ab" when matching "ac". - use analyze_first to optimize non-empty loops - - reduce code duplication - optimize succeed_n and jump_n away when possible - clean up multibyte issues - structure the opcode space into opcode+flag. @@ -133,11 +132,8 @@ char *realloc (); /* Define the syntax stuff for \<, \>, etc. */ -/* This must be nonzero for the wordchar pattern - commands in re_match_2. */ -#ifndef Sword -#define Sword 1 -#endif +/* Sword must be nonzero for the wordchar pattern commands in re_match_2. */ +enum syntaxcode { Swhitespace = 0, Sword = 1 }; #ifdef SWITCH_ENUM_BUG #define SWITCH_ENUM_CAST(x) ((int)(x)) @@ -3462,7 +3458,7 @@ re_compile_fastmap (bufp) not = (re_opcode_t)p[-1] == notsyntaxspec; k = *p++; for (j = 0; j < (1 << BYTEWIDTH); j++) - if ((SYNTAX (j) == (re_opcode_t) k) ^ not) + if ((SYNTAX (j) == (enum syntaxcode) k) ^ not) fastmap[j] = 1; break; #else /* emacs */ @@ -5363,7 +5359,7 @@ re_match_2_internal (bufp, string1, size1, string2, size2, pos, regs, stop) looks like multibyte form. */ c = *d, len = 1; - if ((SYNTAX (c) != (re_opcode_t) mcnt) ^ not) + if ((SYNTAX (c) != (enum syntaxcode) mcnt) ^ not) goto fail; d += len; } -- 2.39.5