Mercurial > emacs
comparison src/regex.c @ 13517:e50cebfd1d7a
(NUM_FAILURE_ITEMS, POP_FAILURE_POINT, PUSH_FAILURE_POINT):
Do not test for backtracking--do the same thing with or without.
(_GNU_SOURCE): Undef before defining.
(re_max_failures): Initialize to just 20000.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 11 Nov 1995 20:51:37 +0000 |
parents | 679c9edb12c5 |
children | c66885b6330c |
comparison
equal
deleted
inserted
replaced
13516:0731fc07cd8b | 13517:e50cebfd1d7a |
---|---|
22 /* AIX requires this to be the first thing in the file. */ | 22 /* AIX requires this to be the first thing in the file. */ |
23 #if defined (_AIX) && !defined (REGEX_MALLOC) | 23 #if defined (_AIX) && !defined (REGEX_MALLOC) |
24 #pragma alloca | 24 #pragma alloca |
25 #endif | 25 #endif |
26 | 26 |
27 #undef _GNU_SOURCE | |
27 #define _GNU_SOURCE | 28 #define _GNU_SOURCE |
28 | 29 |
29 #ifdef HAVE_CONFIG_H | 30 #ifdef HAVE_CONFIG_H |
30 #include <config.h> | 31 #include <config.h> |
31 #endif | 32 #endif |
997 /* Roughly the maximum number of failure points on the stack. Would be | 998 /* Roughly the maximum number of failure points on the stack. Would be |
998 exactly that if always used MAX_FAILURE_SPACE each time we failed. | 999 exactly that if always used MAX_FAILURE_SPACE each time we failed. |
999 This is a variable only so users of regex can assign to it; we never | 1000 This is a variable only so users of regex can assign to it; we never |
1000 change it ourselves. */ | 1001 change it ourselves. */ |
1001 #if defined (MATCH_MAY_ALLOCATE) | 1002 #if defined (MATCH_MAY_ALLOCATE) |
1002 int re_max_failures = 200000; | 1003 int re_max_failures = 20000; |
1003 #else | 1004 #else |
1004 int re_max_failures = 2000; | 1005 int re_max_failures = 2000; |
1005 #endif | 1006 #endif |
1006 | 1007 |
1007 union fail_stack_elt | 1008 union fail_stack_elt |
1153 } \ | 1154 } \ |
1154 \ | 1155 \ |
1155 /* Push the info, starting with the registers. */ \ | 1156 /* Push the info, starting with the registers. */ \ |
1156 DEBUG_PRINT1 ("\n"); \ | 1157 DEBUG_PRINT1 ("\n"); \ |
1157 \ | 1158 \ |
1158 if (!(RE_NO_POSIX_BACKTRACKING & bufp->syntax)) \ | 1159 if (1) \ |
1159 for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ | 1160 for (this_reg = lowest_active_reg; this_reg <= highest_active_reg; \ |
1160 this_reg++) \ | 1161 this_reg++) \ |
1161 { \ | 1162 { \ |
1162 DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ | 1163 DEBUG_PRINT2 (" Pushing reg: %d\n", this_reg); \ |
1163 DEBUG_STATEMENT (num_regs_pushed++); \ | 1164 DEBUG_STATEMENT (num_regs_pushed++); \ |
1214 /* We push at most this many items on the stack. */ | 1215 /* We push at most this many items on the stack. */ |
1215 #define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) | 1216 #define MAX_FAILURE_ITEMS ((num_regs - 1) * NUM_REG_ITEMS + NUM_NONREG_ITEMS) |
1216 | 1217 |
1217 /* We actually push this many items. */ | 1218 /* We actually push this many items. */ |
1218 #define NUM_FAILURE_ITEMS \ | 1219 #define NUM_FAILURE_ITEMS \ |
1219 (((RE_NO_POSIX_BACKTRACKING & bufp->syntax \ | 1220 (((0 \ |
1220 ? 0 : highest_active_reg - lowest_active_reg + 1) \ | 1221 ? 0 : highest_active_reg - lowest_active_reg + 1) \ |
1221 * NUM_REG_ITEMS) \ | 1222 * NUM_REG_ITEMS) \ |
1222 + NUM_NONREG_ITEMS) | 1223 + NUM_NONREG_ITEMS) |
1223 | 1224 |
1224 /* How many items can still be added to the stack without overflowing it. */ | 1225 /* How many items can still be added to the stack without overflowing it. */ |
1275 DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ | 1276 DEBUG_PRINT2 (" Popping high active reg: %d\n", high_reg); \ |
1276 \ | 1277 \ |
1277 low_reg = (unsigned) POP_FAILURE_INT (); \ | 1278 low_reg = (unsigned) POP_FAILURE_INT (); \ |
1278 DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ | 1279 DEBUG_PRINT2 (" Popping low active reg: %d\n", low_reg); \ |
1279 \ | 1280 \ |
1280 if (!(RE_NO_POSIX_BACKTRACKING & bufp->syntax)) \ | 1281 if (1) \ |
1281 for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ | 1282 for (this_reg = high_reg; this_reg >= low_reg; this_reg--) \ |
1282 { \ | 1283 { \ |
1283 DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ | 1284 DEBUG_PRINT2 (" Popping reg: %d\n", this_reg); \ |
1284 \ | 1285 \ |
1285 reg_info[this_reg].word = POP_FAILURE_ELT (); \ | 1286 reg_info[this_reg].word = POP_FAILURE_ELT (); \ |