Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
a7e4cdde
Commit
a7e4cdde
authored
May 15, 1998
by
Richard M. Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(search_buffer): Set search regs for all success with an empty string.
(set_search_regs): Clear out all regs except 0.
parent
8332fa80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
src/search.c
src/search.c
+13
-6
No files found.
src/search.c
View file @
a7e4cdde
...
...
@@ -1005,17 +1005,14 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
if
(
running_asynch_code
)
save_search_regs
();
/* Searching 0 times means don't move. */
/* Null string is found at starting position. */
if
(
len
==
0
)
if
(
len
==
0
||
n
==
0
)
{
set_search_regs
(
pos
,
0
);
return
pos
;
}
/* Searching 0 times means don't move. */
if
(
n
==
0
)
return
pos
;
if
(
RE
&&
!
trivial_regexp_p
(
string
))
{
unsigned
char
*
p1
,
*
p2
;
...
...
@@ -1896,12 +1893,15 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
}
/* Record beginning BEG_BYTE and end BEG_BYTE + NBYTES
for a match just found in the current buffer. */
for the overall match just found in the current buffer.
Also clear out the match data for registers 1 and up. */
static
void
set_search_regs
(
beg_byte
,
nbytes
)
int
beg_byte
,
nbytes
;
{
int
i
;
/* Make sure we have registers in which to store
the match position. */
if
(
search_regs
.
num_regs
==
0
)
...
...
@@ -1911,6 +1911,13 @@ set_search_regs (beg_byte, nbytes)
search_regs
.
num_regs
=
2
;
}
/* Clear out the other registers. */
for
(
i
=
1
;
i
<
search_regs
.
num_regs
;
i
++
)
{
search_regs
.
start
[
i
]
=
-
1
;
search_regs
.
end
[
i
]
=
-
1
;
}
search_regs
.
start
[
0
]
=
BYTE_TO_CHAR
(
beg_byte
);
search_regs
.
end
[
0
]
=
BYTE_TO_CHAR
(
beg_byte
+
nbytes
);
XSETBUFFER
(
last_thing_searched
,
current_buffer
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment