diff options
| author | Richard M. Stallman | 1998-02-03 06:15:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-02-03 06:15:42 +0000 |
| commit | 9f43ad85680a754b934df66346c8cf6395ae5a3a (patch) | |
| tree | beda6ba42b94b878bbfa55dcf064d66ae9222d54 /src | |
| parent | 50fe359bd17a2efecde87d13b1681b5824f215c5 (diff) | |
| download | emacs-9f43ad85680a754b934df66346c8cf6395ae5a3a.tar.gz emacs-9f43ad85680a754b934df66346c8cf6395ae5a3a.zip | |
(search_buffer): New args pos_byte and lim_byte.
(search_command): Pass new args.
Diffstat (limited to 'src')
| -rw-r--r-- | src/search.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/search.c b/src/search.c index 5f5a3e60500..4404fdbe467 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -857,7 +857,7 @@ search_command (string, bound, noerror, count, direction, RE, posix) | |||
| 857 | int posix; | 857 | int posix; |
| 858 | { | 858 | { |
| 859 | register int np; | 859 | register int np; |
| 860 | int lim; | 860 | int lim, lim_byte; |
| 861 | int n = direction; | 861 | int n = direction; |
| 862 | 862 | ||
| 863 | if (!NILP (count)) | 863 | if (!NILP (count)) |
| @@ -868,20 +868,26 @@ search_command (string, bound, noerror, count, direction, RE, posix) | |||
| 868 | 868 | ||
| 869 | CHECK_STRING (string, 0); | 869 | CHECK_STRING (string, 0); |
| 870 | if (NILP (bound)) | 870 | if (NILP (bound)) |
| 871 | lim = n > 0 ? ZV : BEGV; | 871 | { |
| 872 | if (n > 0) | ||
| 873 | lim = ZV, lim_byte = ZV_BYTE; | ||
| 874 | else | ||
| 875 | lim = BEGV, lim_byte = BEGV_BYTE; | ||
| 876 | } | ||
| 872 | else | 877 | else |
| 873 | { | 878 | { |
| 874 | CHECK_NUMBER_COERCE_MARKER (bound, 1); | 879 | CHECK_NUMBER_COERCE_MARKER (bound, 1); |
| 875 | lim = XINT (bound); | 880 | lim = XINT (bound); |
| 881 | lim_byte = CHAR_TO_BYTE (lim); | ||
| 876 | if (n > 0 ? lim < PT : lim > PT) | 882 | if (n > 0 ? lim < PT : lim > PT) |
| 877 | error ("Invalid search bound (wrong side of point)"); | 883 | error ("Invalid search bound (wrong side of point)"); |
| 878 | if (lim > ZV) | 884 | if (lim > ZV) |
| 879 | lim = ZV; | 885 | lim = ZV, lim_byte = ZV_BYTE; |
| 880 | if (lim < BEGV) | 886 | if (lim < BEGV) |
| 881 | lim = BEGV; | 887 | lim = BEGV, lim_byte = BEGV_BYTE; |
| 882 | } | 888 | } |
| 883 | 889 | ||
| 884 | np = search_buffer (string, PT, lim, n, RE, | 890 | np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, |
| 885 | (!NILP (current_buffer->case_fold_search) | 891 | (!NILP (current_buffer->case_fold_search) |
| 886 | ? XCHAR_TABLE (current_buffer->case_canon_table)->contents | 892 | ? XCHAR_TABLE (current_buffer->case_canon_table)->contents |
| 887 | : 0), | 893 | : 0), |
| @@ -897,7 +903,7 @@ search_command (string, bound, noerror, count, direction, RE, posix) | |||
| 897 | { | 903 | { |
| 898 | if (lim < BEGV || lim > ZV) | 904 | if (lim < BEGV || lim > ZV) |
| 899 | abort (); | 905 | abort (); |
| 900 | SET_PT (lim); | 906 | SET_PT_BOTH (lim, lim_byte); |
| 901 | return Qnil; | 907 | return Qnil; |
| 902 | #if 0 /* This would be clean, but maybe programs depend on | 908 | #if 0 /* This would be clean, but maybe programs depend on |
| 903 | a value of nil here. */ | 909 | a value of nil here. */ |
| @@ -965,10 +971,13 @@ trivial_regexp_p (regexp) | |||
| 965 | for this pattern. 0 means backtrack only enough to get a valid match. */ | 971 | for this pattern. 0 means backtrack only enough to get a valid match. */ |
| 966 | 972 | ||
| 967 | static int | 973 | static int |
| 968 | search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix) | 974 | search_buffer (string, pos, pos_byte, lim, lim_byte, n, |
| 975 | RE, trt, inverse_trt, posix) | ||
| 969 | Lisp_Object string; | 976 | Lisp_Object string; |
| 970 | int pos; | 977 | int pos; |
| 978 | int pos_byte; | ||
| 971 | int lim; | 979 | int lim; |
| 980 | int lim_byte; | ||
| 972 | int n; | 981 | int n; |
| 973 | int RE; | 982 | int RE; |
| 974 | Lisp_Object *trt; | 983 | Lisp_Object *trt; |
| @@ -1005,8 +1014,6 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix) | |||
| 1005 | if (RE && !trivial_regexp_p (string)) | 1014 | if (RE && !trivial_regexp_p (string)) |
| 1006 | { | 1015 | { |
| 1007 | struct re_pattern_buffer *bufp; | 1016 | struct re_pattern_buffer *bufp; |
| 1008 | int pos_byte = CHAR_TO_BYTE (pos); | ||
| 1009 | int lim_byte = CHAR_TO_BYTE (lim); | ||
| 1010 | 1017 | ||
| 1011 | bufp = compile_pattern (string, &search_regs, trt, posix, | 1018 | bufp = compile_pattern (string, &search_regs, trt, posix, |
| 1012 | !NILP (current_buffer->enable_multibyte_characters)); | 1019 | !NILP (current_buffer->enable_multibyte_characters)); |
| @@ -1105,8 +1112,6 @@ search_buffer (string, pos, lim, n, RE, trt, inverse_trt, posix) | |||
| 1105 | } | 1112 | } |
| 1106 | else /* non-RE case */ | 1113 | else /* non-RE case */ |
| 1107 | { | 1114 | { |
| 1108 | int pos_byte = CHAR_TO_BYTE (pos); | ||
| 1109 | int lim_byte = CHAR_TO_BYTE (lim); | ||
| 1110 | #ifdef C_ALLOCA | 1115 | #ifdef C_ALLOCA |
| 1111 | int BM_tab_space[0400]; | 1116 | int BM_tab_space[0400]; |
| 1112 | BM_tab = &BM_tab_space[0]; | 1117 | BM_tab = &BM_tab_space[0]; |