commit ca7725496865a60caef68314c1ba4b2d2ec71a11
parent 710a600f22ff24704ba04055c69e6de9b2524ca8
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 9 Jun 2019 19:22:24 +0200
tweaks: use a slightly faster function where appropriate
Also, correct a call of move_mbright() to use the intended format.
Diffstat:
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/search.c b/src/search.c
@@ -226,7 +226,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
from = line->data + move_mbleft(line->data, from - line->data);
found = strstrwrapper(line->data, needle, from);
} else if (!ISSET(BACKWARDS_SEARCH) && *from != '\0') {
- from += move_mbright(from, 0);
+ from += char_length(from);
found = strstrwrapper(line->data, needle, from);
}
} else
@@ -241,7 +241,7 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
* if it's not, continue looking in the rest of the line. */
if (whole_word_only && !is_separate_word(found - line->data,
found_len, line->data)) {
- from = found + move_mbright(found, 0);
+ from = found + char_length(found);
continue;
}
#endif
@@ -955,7 +955,7 @@ void do_find_bracket(void)
wanted_ch = matchbrackets + move_mbleft(matchbrackets,
wanted_ch - matchbrackets);
else
- wanted_ch += move_mbright(wanted_ch, 0);
+ wanted_ch += char_length(wanted_ch);
}
ch_len = char_length(ch);
diff --git a/src/text.c b/src/text.c
@@ -297,11 +297,11 @@ void handle_indent_action(undo *u, bool undoing, bool add_indent)
}
#endif /* !NANO_TINY */
-/* Test whether the string is empty or consists of only blanks. */
+/* Return TRUE when the given string is empty or consists of only blanks. */
bool white_string(const char *s)
{
while (*s != '\0' && (is_blank_mbchar(s) || *s == '\r'))
- s += move_mbright(s, 0);
+ s += char_length(s);
return !*s;
}
@@ -1413,7 +1413,7 @@ bool do_wrap(void)
return FALSE;
/* Step forward to the character just after the blank. */
- wrap_loc += move_mbright(line->data + wrap_loc, 0);
+ wrap_loc = move_mbright(line->data, wrap_loc);
/* When now at end-of-line, no need to wrap. */
if (line->data[wrap_loc] == '\0')