diff options
author | Denys Vlasenko | 2018-12-19 18:09:31 +0100 |
---|---|---|
committer | Denys Vlasenko | 2018-12-19 18:09:31 +0100 |
commit | ea5cad2a0dc7ebbb7de0d1d49ae2b72e6fbd163a (patch) | |
tree | 4bae45d92df1d1b90cc391e1986c054a13dd178a /miscutils/bc.c | |
parent | eac0de55d69a4eea87689c1d4800eb8e80824aca (diff) | |
download | busybox-ea5cad2a0dc7ebbb7de0d1d49ae2b72e6fbd163a.zip busybox-ea5cad2a0dc7ebbb7de0d1d49ae2b72e6fbd163a.tar.gz |
bc: avoid bc_vec_item() calls in bc_vm_run()
function old new delta
bc_vm_run 124 112 -12
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'miscutils/bc.c')
-rw-r--r-- | miscutils/bc.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/miscutils/bc.c b/miscutils/bc.c index 01442c3..c1601a3 100644 --- a/miscutils/bc.c +++ b/miscutils/bc.c @@ -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)) |