[flashrom] [PATCH] Eliminate version string duplication
Stefan Reinauer
stepan at coresystems.de
Wed Jul 22 19:26:42 CEST 2009
On 7/22/09 5:52 PM, Carl-Daniel Hailfinger wrote:
> Eliminate version string duplication.
>
Are you sure the string is ever duplicated? GCC should optimize this...
Anyways,
Acked-by: Stefan Reinauer <stepan at coresystems.de>
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
>
> Index: flashrom-versionstring_once/flash.h
> ===================================================================
> --- flashrom-versionstring_once/flash.h (Revision 657)
> +++ flashrom-versionstring_once/flash.h (Arbeitskopie)
> @@ -379,6 +379,7 @@
>
> /* flashrom.c */
> extern int verbose;
> +extern const char *flashrom_version;
> #define printf_debug(x...) { if (verbose) printf(x); }
> void map_flash_registers(struct flashchip *flash);
> int read_memmapped(struct flashchip *flash, uint8_t *buf, int start, int len);
> Index: flashrom-versionstring_once/flashrom.c
> ===================================================================
> --- flashrom-versionstring_once/flashrom.c (Revision 657)
> +++ flashrom-versionstring_once/flashrom.c (Arbeitskopie)
> @@ -30,6 +30,7 @@
> #include "flash.h"
> #include "flashchips.h"
>
> +const char *flashrom_version = FLASHROM_VERSION;
> char *chip_to_probe = NULL;
> int verbose = 0;
> int programmer = PROGRAMMER_INTERNAL;
> @@ -503,7 +504,7 @@
>
> void print_version(void)
> {
> - printf("flashrom v%s\n", FLASHROM_VERSION);
> + printf("flashrom v%s\n", flashrom_version);
> }
>
> int main(int argc, char *argv[])
> Index: flashrom-versionstring_once/print.c
> ===================================================================
> --- flashrom-versionstring_once/print.c (Revision 657)
> +++ flashrom-versionstring_once/print.c (Arbeitskopie)
> @@ -718,7 +718,7 @@
> {
> time_t t = time(NULL);
>
> - printf(wiki_header, ctime(&t), FLASHROM_VERSION);
> + printf(wiki_header, ctime(&t), flashrom_version);
> print_supported_chips_wiki();
> print_supported_chipsets_wiki();
> print_supported_boards_wiki();
>
>
>
--
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.de • http://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
More information about the flashrom
mailing list