If verbosity is false, then dump_envs is mostly a no-op. In that case, do not even call the function. In other words, move the if-clause where it belongs.
Signed-off-by: Michael Adler <[email protected]> --- tools/bg_setenv.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c index 071c9fc..7b9ce79 100644 --- a/tools/bg_setenv.c +++ b/tools/bg_setenv.c @@ -549,10 +549,8 @@ static void update_environment(BGENV *env) static void dump_envs(void) { for (int i = 0; i < ENV_NUM_CONFIG_PARTS; i++) { - if (verbosity) { - fprintf(stdout, "\n----------------------------\n"); - fprintf(stdout, " Config Partition #%d ", i); - } + fprintf(stdout, "\n----------------------------\n"); + fprintf(stdout, " Config Partition #%d ", i); BGENV *env = bgenv_open_by_index(i); if (!env) { fprintf(stderr, "Error, could not read environment " @@ -560,9 +558,7 @@ static void dump_envs(void) i); return; } - if (verbosity) { - dump_env(env->data); - } + dump_env(env->data); bgenv_close(env); } } @@ -703,13 +699,16 @@ int main(int argc, char **argv) return 1; } - dump_envs(); - if (!write_mode) { + dump_envs(); bgenv_finalize(); return 0; } + if (verbosity) { + dump_envs(); + } + BGENV *env_new = NULL; BGENV *env_current; -- 2.33.0 -- You received this message because you are subscribed to the Google Groups "EFI Boot Guard" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/efibootguard-dev/20211018120916.1005094-1-michael.adler%40siemens.com.
