diff options
author | Richard M. Stallman <rms@gnu.org> | 1997-01-19 01:28:07 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1997-01-19 01:28:07 +0000 |
commit | 8c2bff1bd44783588e7b0a37a1edcd490b193e4f (patch) | |
tree | 6addb6198064bd753c1d8a276495a1831b06e025 /src/search.c | |
parent | af2f42255ec63f7e88d9b97126d8df6aae1420e6 (diff) | |
download | emacs-8c2bff1bd44783588e7b0a37a1edcd490b193e4f.tar.gz |
(skip_chars): Optimize by not calling SET_PT in the loop.
Diffstat (limited to 'src/search.c')
-rw-r--r-- | src/search.c | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/search.c b/src/search.c index 45119e60617..1b2a6f299cb 100644 --- a/src/search.c +++ b/src/search.c @@ -730,7 +730,7 @@ skip_chars (forwardp, syntaxp, string, lim) { c = *p++; if (syntaxp) - fastmap[c] = 1; + fastmap[syntax_spec_code[c]] = 1; else { if (c == '\\') @@ -754,9 +754,6 @@ skip_chars (forwardp, syntaxp, string, lim) } } - if (syntaxp && fastmap['-'] != 0) - fastmap[' '] = 1; - /* If ^ was the first character, complement the fastmap. */ if (negate) @@ -765,37 +762,38 @@ skip_chars (forwardp, syntaxp, string, lim) { 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); |