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.
This commit is contained in:
Hans Ulrich Niedermann
2024-02-25 23:28:53 +01:00
parent 5c891b347e
commit dfcd5cc6d8

View File

@@ -29,6 +29,7 @@
*
*/
/* For AVRDUDE_FULL_VERSION and possibly others */
#include "ac_cfg.h"
#include <stdio.h>
@@ -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) {