vi: somewhat more readable code, no logic changes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2021-07-13 16:16:21 +02:00
parent 2759201401
commit 36feb26824

View File

@ -2683,12 +2683,13 @@ static char *expand_args(char *args)
// Like strchr() but skipping backslash-escaped characters // Like strchr() but skipping backslash-escaped characters
static char *strchr_backslash(const char *s, int c) static char *strchr_backslash(const char *s, int c)
{ {
for (; *s; ++s) { while (*s) {
if (*s == c) { if (*s == c) {
return (char *)s; return (char *)s;
} else if (*s == '\\' && *++s == '\0') { if (*s == '\\')
break; if (*++s == '\0')
} break;
s++;
} }
return NULL; return NULL;
} }
@ -3237,10 +3238,10 @@ static void colon(char *buf)
# endif # endif
if (TEST_LEN_F) // match can be empty, no delete needed if (TEST_LEN_F) // match can be empty, no delete needed
text_hole_delete(found, found + len_F - 1, text_hole_delete(found, found + len_F - 1,
TEST_UNDO1 ? ALLOW_UNDO_CHAIN: ALLOW_UNDO); TEST_UNDO1 ? ALLOW_UNDO_CHAIN : ALLOW_UNDO);
if (len_R) { // insert the "replace" pattern, if required if (len_R != 0) { // insert the "replace" pattern, if required
bias = string_insert(found, R, bias = string_insert(found, R,
TEST_UNDO2 ? ALLOW_UNDO_CHAIN: ALLOW_UNDO); TEST_UNDO2 ? ALLOW_UNDO_CHAIN : ALLOW_UNDO);
found += bias; found += bias;
ls += bias; ls += bias;
dot = ls; dot = ls;
@ -3249,7 +3250,7 @@ static void colon(char *buf)
# if ENABLE_FEATURE_VI_REGEX_SEARCH # if ENABLE_FEATURE_VI_REGEX_SEARCH
free(R); free(R);
# endif # endif
if (TEST_LEN_F || len_R) { if (TEST_LEN_F || len_R != 0) {
dot = ls; dot = ls;
subs++; subs++;
# if ENABLE_FEATURE_VI_VERBOSE_STATUS # if ENABLE_FEATURE_VI_VERBOSE_STATUS