# HG changeset patch # User Richard M. Stallman # Date 809981010 0 # Node ID ed39ba26313bb35075f01d71e14b86a6c9f80fe7 # Parent 385a67ad96c30c0e17e7bb86e459739ae7d08039 (re_search_2): If pattern starts with \=, optimize search. diff -r 385a67ad96c3 -r ed39ba26313b src/regex.c --- a/src/regex.c Fri Sep 01 02:02:17 1995 +0000 +++ b/src/regex.c Fri Sep 01 18:43:30 1995 +0000 @@ -3036,7 +3036,7 @@ case at_dot: case after_dot: continue; -#endif /* not emacs */ +#endif /* emacs */ case no_op: @@ -3275,6 +3275,17 @@ range = 1; } +#ifdef emacs + /* In a forward search for something that starts with \=. + don't keep searching past point. */ + if (bufp->used > 0 && (re_opcode_t) bufp->buffer[0] == at_dot && range > 0) + { + range = PT - startpos; + if (range <= 0) + return -1; + } +#endif /* emacs */ + /* Update the fastmap now if not correct already. */ if (fastmap && !bufp->fastmap_accurate) if (re_compile_fastmap (bufp) == -2) @@ -4678,13 +4689,6 @@ if (PTR_CHAR_POS ((unsigned char *) d) <= point) goto fail; break; -#if 0 /* not emacs19 */ - case at_dot: - DEBUG_PRINT1 ("EXECUTING at_dot.\n"); - if (PTR_CHAR_POS ((unsigned char *) d) + 1 != point) - goto fail; - break; -#endif /* not emacs19 */ case syntaxspec: DEBUG_PRINT2 ("EXECUTING syntaxspec %d.\n", mcnt);