aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2021-07-13 16:16:21 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2021-07-13 16:16:21 +0200
commit36feb2682481d55ae49df899c38e16130227ba4a (patch)
tree37f9376873ec433d596aa062bee90b5518c24033
parent2759201401cf87a9a8621edd9e5f44dfe838407c (diff)
downloadbusybox-w32-36feb2682481d55ae49df899c38e16130227ba4a.tar.gz
busybox-w32-36feb2682481d55ae49df899c38e16130227ba4a.tar.bz2
busybox-w32-36feb2682481d55ae49df899c38e16130227ba4a.zip
vi: somewhat more readable code, no logic changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--editors/vi.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/editors/vi.c b/editors/vi.c
index c6bb74cfb..5c601c759 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -2683,12 +2683,13 @@ static char *expand_args(char *args)
2683// Like strchr() but skipping backslash-escaped characters 2683// Like strchr() but skipping backslash-escaped characters
2684static char *strchr_backslash(const char *s, int c) 2684static char *strchr_backslash(const char *s, int c)
2685{ 2685{
2686 for (; *s; ++s) { 2686 while (*s) {
2687 if (*s == c) { 2687 if (*s == c) {
2688 return (char *)s; 2688 return (char *)s;
2689 } else if (*s == '\\' && *++s == '\0') { 2689 if (*s == '\\')
2690 break; 2690 if (*++s == '\0')
2691 } 2691 break;
2692 s++;
2692 } 2693 }
2693 return NULL; 2694 return NULL;
2694} 2695}
@@ -3237,10 +3238,10 @@ static void colon(char *buf)
3237# endif 3238# endif
3238 if (TEST_LEN_F) // match can be empty, no delete needed 3239 if (TEST_LEN_F) // match can be empty, no delete needed
3239 text_hole_delete(found, found + len_F - 1, 3240 text_hole_delete(found, found + len_F - 1,
3240 TEST_UNDO1 ? ALLOW_UNDO_CHAIN: ALLOW_UNDO); 3241 TEST_UNDO1 ? ALLOW_UNDO_CHAIN : ALLOW_UNDO);
3241 if (len_R) { // insert the "replace" pattern, if required 3242 if (len_R != 0) { // insert the "replace" pattern, if required
3242 bias = string_insert(found, R, 3243 bias = string_insert(found, R,
3243 TEST_UNDO2 ? ALLOW_UNDO_CHAIN: ALLOW_UNDO); 3244 TEST_UNDO2 ? ALLOW_UNDO_CHAIN : ALLOW_UNDO);
3244 found += bias; 3245 found += bias;
3245 ls += bias; 3246 ls += bias;
3246 dot = ls; 3247 dot = ls;
@@ -3249,7 +3250,7 @@ static void colon(char *buf)
3249# if ENABLE_FEATURE_VI_REGEX_SEARCH 3250# if ENABLE_FEATURE_VI_REGEX_SEARCH
3250 free(R); 3251 free(R);
3251# endif 3252# endif
3252 if (TEST_LEN_F || len_R) { 3253 if (TEST_LEN_F || len_R != 0) {
3253 dot = ls; 3254 dot = ls;
3254 subs++; 3255 subs++;
3255# if ENABLE_FEATURE_VI_VERBOSE_STATUS 3256# if ENABLE_FEATURE_VI_VERBOSE_STATUS