Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
8b264ecb
Commit
8b264ecb
authored
Nov 22, 2009
by
Andreas Schwab
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(simple_search): Avoid CHAR_TO_BYTE in inner loop when
searching backwards through multibyte buffer.
parent
433d9ace
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
src/ChangeLog
src/ChangeLog
+5
-0
src/search.c
src/search.c
+12
-15
No files found.
src/ChangeLog
View file @
8b264ecb
2009-11-22 Andreas Schwab <schwab@linux-m68k.org>
* search.c (simple_search): Avoid CHAR_TO_BYTE in inner loop when
searching backwards through multibyte buffer.
2009-11-21 Jan Djärv <jan.h.d@swipnet.se>
* xterm.c: #include xgselect.h.
...
...
src/search.c
View file @
8b264ecb
...
...
@@ -1609,39 +1609,36 @@ simple_search (n, pat, len, len_byte, trt, pos, pos_byte, lim, lim_byte)
while
(
1
)
{
/* Try matching at position POS. */
EMACS_INT
this_pos
=
pos
-
len
;
EMACS_INT
this_pos_byte
;
EMACS_INT
this_pos
=
pos
;
EMACS_INT
this_pos_byte
=
pos_byte
;
int
this_len
=
len
;
unsigned
char
*
p
=
pat
;
unsigned
char
*
p
=
pat
+
len_byte
;
if
(
this_pos
<
lim
||
(
pos_byte
-
len_byte
)
<
lim_byte
)
if
(
this_pos
-
len
<
lim
||
(
pos_byte
-
len_byte
)
<
lim_byte
)
goto
stop
;
this_pos_byte
=
CHAR_TO_BYTE
(
this_pos
);
match_byte
=
pos_byte
-
this_pos_byte
;
while
(
this_len
>
0
)
{
int
charlen
,
buf_charlen
;
int
charlen
;
int
pat_ch
,
buf_ch
;
pat_ch
=
STRING_CHAR_AND_LENGTH
(
p
,
charlen
);
buf_ch
=
STRING_CHAR_AND_LENGTH
(
BYTE_POS_ADDR
(
this_pos_byte
),
buf_charlen
);
DEC_BOTH
(
this_pos
,
this_pos_byte
);
PREV_CHAR_BOUNDARY
(
p
,
pat
);
pat_ch
=
STRING_CHAR
(
p
);
buf_ch
=
STRING_CHAR
(
BYTE_POS_ADDR
(
this_pos_byte
));
TRANSLATE
(
buf_ch
,
trt
,
buf_ch
);
if
(
buf_ch
!=
pat_ch
)
break
;
this_len
--
;
p
+=
charlen
;
this_pos_byte
+=
buf_charlen
;
this_pos
++
;
}
if
(
this_len
==
0
)
{
pos
-=
len
;
pos_byte
-=
match_byte
;
match_byte
=
pos_byte
-
this_pos_byte
;
pos
=
this_pos
;
pos_byte
=
this_pos_byte
;
break
;
}
...
...
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