# HG changeset patch # User Richard M. Stallman # Date 853637287 0 # Node ID 40ea37a6dc40b114fcb319fff8dfe61876a41249 # Parent b020aae1fa01b7972097602b33a2d2f8890fdff5 (skip_chars): Optimize by not calling SET_PT in the loop. diff -r b020aae1fa01 -r 40ea37a6dc40 src/search.c --- a/src/search.c Sun Jan 19 00:48:00 1997 +0000 +++ b/src/search.c Sun Jan 19 01:28:07 1997 +0000 @@ -730,7 +730,7 @@ { c = *p++; if (syntaxp) - fastmap[c] = 1; + fastmap[syntax_spec_code[c]] = 1; else { if (c == '\\') @@ -754,9 +754,6 @@ } } - if (syntaxp && fastmap['-'] != 0) - fastmap[' '] = 1; - /* If ^ was the first character, complement the fastmap. */ if (negate) @@ -765,37 +762,38 @@ { int start_point = PT; + int pos = PT; immediate_quit = 1; if (syntaxp) { - if (forwardp) { - while (PT < XINT (lim) - && fastmap[(unsigned char) syntax_code_spec[(int) SYNTAX (FETCH_CHAR (PT))]]) - SET_PT (PT + 1); + while (pos < XINT (lim) + && fastmap[(int) SYNTAX (FETCH_CHAR (pos))]) + pos++; } else { - while (PT > XINT (lim) - && fastmap[(unsigned char) syntax_code_spec[(int) SYNTAX (FETCH_CHAR (PT - 1))]]) - SET_PT (PT - 1); + while (pos > XINT (lim) + && fastmap[(int) SYNTAX (FETCH_CHAR (pos - 1))]) + pos--; } } else { if (forwardp) { - while (PT < XINT (lim) && fastmap[FETCH_CHAR (PT)]) - SET_PT (PT + 1); + while (pos < XINT (lim) && fastmap[FETCH_CHAR (pos)]) + pos++; } else { - while (PT > XINT (lim) && fastmap[FETCH_CHAR (PT - 1)]) - SET_PT (PT - 1); + while (pos > XINT (lim) && fastmap[FETCH_CHAR (pos - 1)]) + pos--; } } + SET_PT (pos); immediate_quit = 0; return make_number (PT - start_point);