[PATCH V2 3/5] style: simplify removing unneeded code

5 views
Skip to first unread message

Silvano Cirujano Cuesta

unread,
Dec 1, 2020, 7:33:40 AM12/1/20
to efibootg...@googlegroups.com
Flag "output_to_file" not needed, since "envfilepath != NULL" only when
output to file requested.

Signed-off-by: Silvano Cirujano Cuesta <silvano.cir...@siemens.com>
---
tools/bg_setenv.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index 3d7329f..0395751 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -53,7 +53,6 @@ static struct argp_option options_printenv[] = {
{0}};

struct arguments {
- bool output_to_file;
int which_part;
};

@@ -351,7 +350,6 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
(uint8_t *)arg, strlen(arg) + 1);
break;
case 'f':
- arguments->output_to_file = true;
res = asprintf(&envfilepath, "%s/%s", arg, FAT_ENV_FILENAME);
if (res == -1) {
return ENOMEM;
@@ -557,7 +555,6 @@ int main(int argc, char **argv)
}

struct arguments arguments;
- arguments.output_to_file = false;
arguments.which_part = 0;

STAILQ_INIT(&head);
@@ -573,7 +570,7 @@ int main(int argc, char **argv)
/* arguments are parsed, journal is filled */

/* is output to file ? */
- if (arguments.output_to_file) {
+ if (envfilepath) {
/* execute journal and write to file */
BGENV env;
BG_ENVDATA data;
--
2.29.2

Jan Kiszka

unread,
Dec 1, 2020, 7:55:00 AM12/1/20
to [ext] Silvano Cirujano Cuesta, efibootg...@googlegroups.com
Applied up to here. Thanks.

Could you reorder patch 4 and 5 on top of current next? That would avoid
adding code in one place, just to move it around in the next moment.

Jan

--
Siemens AG, T RDA IOT
Corporate Competence Center Embedded Linux
Reply all
Reply to author
Forward
0 new messages