bc: avoid bc_vec_item() calls in bc_vm_run()
authorDenys Vlasenko <vda.linux@googlemail.com>
Wed, 19 Dec 2018 17:09:31 +0000 (18:09 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Wed, 19 Dec 2018 17:09:31 +0000 (18:09 +0100)
function                                             old     new   delta
bc_vm_run                                            124     112     -12

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

index 01442c33b43ffb644c380a21306273a80cc0fe7f..c1601a3e44e95dd0e9577fdef8c60d37992a2fb8 100644 (file)
@@ -6926,6 +6926,7 @@ static const char bc_lib[] ALIGN1 = {
 
 static BC_STATUS zbc_vm_exec(void)
 {
+       char **fname;
        BcStatus s;
        size_t i;
 
@@ -6941,13 +6942,16 @@ static BC_STATUS zbc_vm_exec(void)
 #endif
 
        s = BC_STATUS_SUCCESS;
-       for (i = 0; !s && i < G.files.len; ++i)
-               s = zbc_vm_file(*((char **) bc_vec_item(&G.files, i)));
-       if (ENABLE_FEATURE_CLEAN_UP && s && !G_ttyin) {
-               // Debug config, non-interactive mode:
-               // return all the way back to main.
-               // Non-debug builds do not come here, they exit.
-               RETURN_STATUS(s);
+       fname = (void*)G.files.v;
+       for (i = 0; i < G.files.len; i++) {
+               s = zbc_vm_file(*fname++);
+               if (ENABLE_FEATURE_CLEAN_UP && !G_ttyin && s) {
+                       // Debug config, non-interactive mode:
+                       // return all the way back to main.
+                       // Non-debug builds do not come here
+                       // in non-interactive mode, they exit.
+                       RETURN_STATUS(s);
+               }
        }
 
        if (IS_BC || (option_mask32 & BC_FLAG_I))