Cache config_file components in AVRPART and PROGRAMMER structures

Some 90% of the space of AVRPART and some 50% of PROGRAMMER is occupied by a
4 kB array config_file[] that contains the configuration file name. In
preparation of developer options that output a raw dump of the part
descriptions, this commit changes the config_file components from a large
array, which is duplicated in each part and programmer description, to a
cached string for each config file allowing for smaller raw dumps.

This commit also changes the config file name to its realpath(), eg, shortens
unwarranted `/bin/../etc/` file name components. It also changes the global
variable names `infile` and `fileno` to cfg_infile and cfg_fileno for an ever
so slight improvement of code clarity.
This commit is contained in:
Stefan Rueger
2022-07-18 18:10:09 +01:00
parent 87401d341e
commit f95a1d3448
7 changed files with 80 additions and 35 deletions

View File

@@ -79,7 +79,7 @@ PROGRAMMER * pgm_new(void)
pgm->usbpid = lcreat(NULL, 0);
pgm->desc[0] = 0;
pgm->type[0] = 0;
pgm->config_file[0] = 0;
pgm->config_file = NULL;
pgm->lineno = 0;
pgm->baudrate = 0;
pgm->initpgm = NULL;