mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
(apply_rules_going_right): minor optimization.
Make easy tests first, call strlen() at the end of test sequence. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
fd3df33310
commit
6b67d123d9
@ -449,11 +449,12 @@ apply_rules_going_right (WEdit * edit, off_t i)
|
||||
{
|
||||
/* when both context and keyword terminate with a newline,
|
||||
the context overflows to the next line and colorizes it incorrectly */
|
||||
if (_rule._context != 0 && k->keyword[strlen (k->keyword) - 1] == '\n')
|
||||
if (e > i + 1 && _rule._context != 0
|
||||
&& k->keyword[strlen (k->keyword) - 1] == '\n')
|
||||
{
|
||||
r = CONTEXT_RULE (g_ptr_array_index (edit->rules, _rule._context));
|
||||
if (r->right != NULL && r->right[0] != '\0'
|
||||
&& r->right[strlen (r->right) - 1] == '\n' && e > i + 1)
|
||||
&& r->right[strlen (r->right) - 1] == '\n')
|
||||
e--;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user