[flashrom] [PATCH] Print supported flash chips as narrow as possible

Uwe Hermann uwe at hermann-uwe.de
Sun Jul 18 01:03:27 CEST 2010


On Sat, Jul 17, 2010 at 05:31:12PM +0200, Carl-Daniel Hailfinger wrote:
> Print supported flash chips as narrow as possible.
> Fix a bug where 4 GB of spaces would be printed per line if a vendor
> name was longer than 10 chars.
> 
> This patch (or a smaller version) is needed to commit MoselVitelic chip
> support.
> 
> Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>

Tested, looks OK.

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

The simple fix would have looked somewhat like this:

Index: print.c
===================================================================
--- print.c	(Revision 1088)
+++ print.c	(Arbeitskopie)
@@ -104,11 +104,11 @@
 			continue;
 
 		printf("%s", f->vendor);
-		for (i = 0; i < 10 - strlen(f->vendor); i++)
+		for (i = 0; i < 14 - strlen(f->vendor); i++)
 			printf(" ");
 		printf("%s", f->name);
 
-		pos = 10 + strlen(f->name);
+		pos = 14 + strlen(f->name);
 		while (pos < okcol) {
 			printf("\t");
 			pos += 8 - (pos % 8);

But admittedly, your patch is more generic and fixes the problem
permanently.

 
Uwe.
-- 
http://hermann-uwe.de     | http://sigrok.org
http://randomprojects.org | http://unmaintained-free-software.org




More information about the flashrom mailing list