From dfcd5cc6d8274820dc60f173c8c478acf1b45d28 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Sun, 25 Feb 2024 23:28:53 +0100 Subject: [PATCH] Directly use AVRDUDE_FULL_VERSION string macro Directly use the AVRDUDE_FULL_VERSION macro instead of first defining an initialized variable which is never changed and then using that variable. This means one less layer of indirection both for the computer and for the programmer to go through when trying to understand the code. --- src/main.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index fe6a5dbf..bd756b34 100644 --- a/src/main.c +++ b/src/main.c @@ -29,6 +29,7 @@ * */ +/* For AVRDUDE_FULL_VERSION and possibly others */ #include "ac_cfg.h" #include @@ -51,9 +52,6 @@ #include "config.h" #include "developer_opts.h" -/* Get VERSION from ac_cfg.h */ -char * version = AVRDUDE_FULL_VERSION; - char * progname; char progbuf[PATH_MAX]; /* temporary buffer of spaces the same length as progname; used for lining up @@ -266,7 +264,7 @@ static void usage(void) " -l logfile Use logfile rather than stderr for diagnostics\n" " -? Display this usage\n" "\navrdude version %s, https://github.com/avrdudes/avrdude\n", - progname, strlen(cfg) < 24? "config file ": "", cfg, version); + progname, strlen(cfg) < 24? "config file ": "", cfg, AVRDUDE_FULL_VERSION); free(cfg); } @@ -1058,7 +1056,7 @@ int main(int argc, char * argv []) * they are running */ msg_notice("\n"); - pmsg_notice("Version %s\n", version); + pmsg_notice("Version %s\n", AVRDUDE_FULL_VERSION); imsg_notice("Copyright the AVRDUDE authors;\n"); imsg_notice("see https://github.com/avrdudes/avrdude/blob/main/AUTHORS\n\n"); @@ -1092,9 +1090,9 @@ int main(int argc, char * argv []) } } - if(!str_eq(avrdude_conf_version, version)) { + if(!str_eq(avrdude_conf_version, AVRDUDE_FULL_VERSION)) { pmsg_warning("System wide configuration file version (%s)\n", avrdude_conf_version); - imsg_warning("does not match Avrdude build version (%s)\n", version); + imsg_warning("does not match Avrdude build version (%s)\n", AVRDUDE_FULL_VERSION); } if (lsize(additional_config_files) > 0) {