From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Fri, 13 Jun 2008 08:14:17 -0400 Subject: [U-Boot-Users] Patch to clean up syntax highlighting In-Reply-To: <4851EFA3.3010505@gmail.com> References: <48515BDA.8080404@harris.com> <4851EFA3.3010505@gmail.com> Message-ID: <48526499.6000804@ge.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Jerry Van Baren wrote: > Steven A. Falco wrote: >> My text-editor (vim) has a bit of trouble syntax-highlighting the cmd_nvedit.c >> file, because it apparently does not parse C ifdef/else/endif. The following >> patch does not change the behavior of the code at all, but does allow the >> editor to properly syntax-highlight the file. >> >> Comments invited. > > OK, you invited comments so I'll be the designated curmudgeon tonight... > I'm not wild about uglifying our code to accommodating vim syntax > highlighting limitations. Perhaps you can fix the vim syntax > highlighting instead? > >> Signed-off-by: Steve Falco >> >> diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c >> index 9c5d1fc..1ac91ea 100644 >> --- a/common/cmd_nvedit.c >> +++ b/common/cmd_nvedit.c >> @@ -179,11 +179,12 @@ int _do_setenv (int flag, int argc, char *argv[]) >> * Ethernet Address and serial# can be set only once, >> * ver is readonly. >> */ >> + if ( >> #ifdef CONFIG_HAS_UID >> /* Allow serial# forced overwrite with 0xdeaf4add flag */ >> - if ( ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) || >> + ((strcmp (name, "serial#") == 0) && (flag != 0xdeaf4add)) || >> #else >> - if ( (strcmp (name, "serial#") == 0) || >> + (strcmp (name, "serial#") == 0) || >> #endif >> ((strcmp (name, "ethaddr") == 0) >> #if defined(CONFIG_OVERWRITE_ETHADDR_ONCE) && defined(CONFIG_ETHADDR) > > I probably should confess I don't use syntax highlighting so that > probably factors in to my lack of sympathy. > > Best regards, > gvb Hi Steven, I got a good night's sleep and a cup of coffee in me and so I'm a little more mellow this morning. ;-) Looking at the source code, its pretty ugly already. Your change doesn't make it any more ugly and it could be argued that it is slightly less ugly (your patch removes the duplication of the "if( (...)" statement). I also don't see any alternative that would make the code beautiful. :-( Anyway, I formally withdraw my objection to this patch. Best regards, gvb