aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1997-01-19 01:28:07 +0000
committerRichard M. Stallman1997-01-19 01:28:07 +0000
commit5caa45d38ac6886add587da5ad8695a1f1de3651 (patch)
tree5396e7d3a7c893d464b7a8388052a7b7480ae537 /src
parent474a797e4c69df527c0ae9687790b221876bcd96 (diff)
downloademacs-5caa45d38ac6886add587da5ad8695a1f1de3651.tar.gz
emacs-5caa45d38ac6886add587da5ad8695a1f1de3651.zip
(skip_chars): Optimize by not calling SET_PT in the loop.
Diffstat (limited to 'src')
-rw-r--r--src/search.c28
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)
730 { 730 {
731 c = *p++; 731 c = *p++;
732 if (syntaxp) 732 if (syntaxp)
733 fastmap[c] = 1; 733 fastmap[syntax_spec_code[c]] = 1;
734 else 734 else
735 { 735 {
736 if (c == '\\') 736 if (c == '\\')
@@ -754,9 +754,6 @@ skip_chars (forwardp, syntaxp, string, lim)
754 } 754 }
755 } 755 }
756 756
757 if (syntaxp && fastmap['-'] != 0)
758 fastmap[' '] = 1;
759
760 /* If ^ was the first character, complement the fastmap. */ 757 /* If ^ was the first character, complement the fastmap. */
761 758
762 if (negate) 759 if (negate)
@@ -765,37 +762,38 @@ skip_chars (forwardp, syntaxp, string, lim)
765 762
766 { 763 {
767 int start_point = PT; 764 int start_point = PT;
765 int pos = PT;
768 766
769 immediate_quit = 1; 767 immediate_quit = 1;
770 if (syntaxp) 768 if (syntaxp)
771 { 769 {
772
773 if (forwardp) 770 if (forwardp)
774 { 771 {
775 while (PT < XINT (lim) 772 while (pos < XINT (lim)
776 && fastmap[(unsigned char) syntax_code_spec[(int) SYNTAX (FETCH_CHAR (PT))]]) 773 && fastmap[(int) SYNTAX (FETCH_CHAR (pos))])
777 SET_PT (PT + 1); 774 pos++;
778 } 775 }
779 else 776 else
780 { 777 {
781 while (PT > XINT (lim) 778 while (pos > XINT (lim)
782 && fastmap[(unsigned char) syntax_code_spec[(int) SYNTAX (FETCH_CHAR (PT - 1))]]) 779 && fastmap[(int) SYNTAX (FETCH_CHAR (pos - 1))])
783 SET_PT (PT - 1); 780 pos--;
784 } 781 }
785 } 782 }
786 else 783 else
787 { 784 {
788 if (forwardp) 785 if (forwardp)
789 { 786 {
790 while (PT < XINT (lim) && fastmap[FETCH_CHAR (PT)]) 787 while (pos < XINT (lim) && fastmap[FETCH_CHAR (pos)])
791 SET_PT (PT + 1); 788 pos++;
792 } 789 }
793 else 790 else
794 { 791 {
795 while (PT > XINT (lim) && fastmap[FETCH_CHAR (PT - 1)]) 792 while (pos > XINT (lim) && fastmap[FETCH_CHAR (pos - 1)])
796 SET_PT (PT - 1); 793 pos--;
797 } 794 }
798 } 795 }
796 SET_PT (pos);
799 immediate_quit = 0; 797 immediate_quit = 0;
800 798
801 return make_number (PT - start_point); 799 return make_number (PT - start_point);