mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
* view.c (is_nroff_sequence): Reordered the statements to gain
a speed-off of 30 percent on a 10 MB file.
This commit is contained in:
parent
f10fe35005
commit
1300633147
@ -1,3 +1,8 @@
|
||||
2005-06-27 Roland Illig <roland.illig@gmx.de>
|
||||
|
||||
* view.c (is_nroff_sequence): Reordered the statements to gain
|
||||
a speed-off of 30 percent on a 10 MB file.
|
||||
|
||||
2005-06-22 Pavel Tsekov <ptsekov@gmx.net>
|
||||
|
||||
* main.h: Export edit_one_file.
|
||||
|
21
src/view.c
21
src/view.c
@ -781,16 +781,23 @@ view_ccache_dump (WView *view)
|
||||
static gboolean
|
||||
is_nroff_sequence (WView *view, offset_type offset)
|
||||
{
|
||||
int c0, c1, c2, retval;
|
||||
int c0, c1, c2;
|
||||
|
||||
/* The following commands are ordered to speed up the calculation. */
|
||||
|
||||
c1 = get_byte_indexed (view, offset, 1);
|
||||
if (c1 == -1 || c1 != '\b')
|
||||
return FALSE;
|
||||
|
||||
c0 = get_byte_indexed (view, offset, 0);
|
||||
c1 = get_byte_indexed (view, offset, 1);
|
||||
c2 = get_byte_indexed (view, offset, 2);
|
||||
if (c0 == -1 || !is_printable(c0))
|
||||
return FALSE;
|
||||
|
||||
retval = (c0 != -1 && c1 != -1 && c2 != -1
|
||||
&& is_printable (c0) && c1 == '\b' && is_printable (c2)
|
||||
&& (c0 == c2 || c0 == '_' || (c0 == '+' && c2 == 'o')));
|
||||
return retval;
|
||||
c2 = get_byte_indexed (view, offset, 2);
|
||||
if (c2 == -1 || !is_printable(c2))
|
||||
return FALSE;
|
||||
|
||||
return (c0 == c2 || c0 == '_' || (c0 == '+' && c2 == 'o'));
|
||||
}
|
||||
|
||||
/* Look up the missing components of ''coord'', which are given by
|
||||
|
Loading…
Reference in New Issue
Block a user