vi: small code shrink
authorDenys Vlasenko <vda.linux@googlemail.com>
Sat, 11 Jul 2009 22:51:15 +0000 (00:51 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sat, 11 Jul 2009 22:51:15 +0000 (00:51 +0200)
function                                             old     new   delta
vi_word_motion                                       185     165     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
libbb/lineedit.c

index ab329722020b0d022df77303403a0663073a35de..6e836d83ec8e593e8f8763b89c3dcabd3bd9a2c1 100644 (file)
@@ -1296,8 +1296,10 @@ vi_word_motion(int eat)
 
        if (BB_isalnum(command[cursor]) || command[cursor] == '_') {
                while (cursor < command_len
-                && (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_'))
+                && (BB_isalnum(command[cursor+1]) || command[cursor+1] == '_')
+               ) {
                        input_forward();
+               }
        } else if (BB_ispunct(command[cursor])) {
                while (cursor < command_len && BB_ispunct(command[cursor+1]))
                        input_forward();
@@ -1306,9 +1308,10 @@ vi_word_motion(int eat)
        if (cursor < command_len)
                input_forward();
 
-       if (eat && cursor < command_len && BB_isspace(command[cursor]))
+       if (eat) {
                while (cursor < command_len && BB_isspace(command[cursor]))
                        input_forward();
+       }
 }
 
 static void
@@ -1592,7 +1595,7 @@ static int lineedit_read_key(char *read_key_buffer)
 
 /* leave out the "vi-mode"-only case labels if vi editing isn't
  * configured. */
-#define vi_case(caselabel) IF_FEATURE_EDITING(case caselabel)
+#define vi_case(caselabel) IF_FEATURE_EDITING_VI(case caselabel)
 
 /* convert uppercase ascii to equivalent control char, for readability */
 #undef CTRL