[coreboot] [PATCH] Fixes the build error while generating option_table.h

Vikram Narayanan vikram186 at gmail.com
Mon May 9 15:50:02 CEST 2011


> Am 08.05.2011 20:01, schrieb Peter Stuge:
>> if(!strncmp(line[strspn(line," ")],"\r\n",2) continue;
> More like:
> char val=line[strspn(line," ")];
> if (val=='#' || val=='\n' || val=='\r') continue;
> 
> This has the benefit of handling
> "    # comment"
> and mac-style newlines, too.
Thanks for all your comments. 
As Patrick suggested, here is the new patch.

Signed-off by: Vikram Narayanan <vikram186 at gmail.com>
Signed-off by: Patrick Georgi <patrick at georgi-clan.de>
---
--- C:/coreboot/util/options/build_opt_tbl.c.orig	Sun May  8 22:18:54 2011
+++ C:/coreboot/util/options/build_opt_tbl.c	Mon May  9 19:09:32 2011
@@ -276,6 +276,7 @@
 	int enum_length;
 	int len;
 	char buf[16];
+	char val;
 
         for(i=1;i<argc;i++) {
                 if(argv[i][0]!='-') {
@@ -371,8 +372,9 @@
 		}
 
 		/* skip commented and blank lines */
-		if(line[0]=='#') continue;
-		if(line[strspn(line," ")]=='\n') continue;
+		val = line[strspn(line," ")];
+		/* takes care of *nix,Mac and Windows line ending formats */
+		if (val=='#' || val=='\n' || val=='\r') continue;
 		/* scan in the input data */
 		sscanf(line,"%d %d %c %d %s",
 			&ce->bit,&ce->length,&uc,&ce->config_id,&ce->name[0]);

-
Thanks,
Vikram




More information about the coreboot mailing list