[syslinux] rosh patch V2, stylistic note unified

Geert Stappers stappers at stappers.nl
Sun Apr 12 02:53:04 PDT 2009


Op 20090308 om 11:24 schreef Keith Schincke:
> On Sun, Mar 8, 2009 at 12:48 AM, H. Peter Anvin <hpa at zytor.com> wrote:
> 
> >
> > Stylistic note: it is stylistically considered appropriate to put an
> > extra set of parens around an assignment used in the context of a
> > boolean expression.  gcc will warn if you don't.  This thus should be:
> >
> >        while ( (de = readdir(d)) ) {
> >                filepos++;
> >
>
> Not a problem. I will start taking care of these types of items.

For what it's worth:

diff --git a/com32/rosh/rosh.c b/com32/rosh/rosh.c
index dc3f64d..db08f5d 100644
--- a/com32/rosh/rosh.c
+++ b/com32/rosh/rosh.c
@@ -369,7 +369,7 @@ ROSH_DEBUG("--'%s'\n", filestr);
 		if (S_ISDIR(fdstat.st_mode)) {
 			ROSH_DEBUG("PATH '%s' is a directory\n", ifilstr);
 			d = fdopendir(fd);
-			while ( de = readdir(d) ) {
+			while ( (de = readdir(d)) ) {
 #ifdef DO_DEBUG
 				filestr2[0] = 0;
 				file2pos = strlen(filestr);
@@ -402,7 +402,7 @@ ROSH_DEBUG("--'%s'\n", filestr);
 			d = opendir(filestr);
 			if (d != NULL) {
 printf("DIR:'%s'    %8d %8d\n", d->dd_name, d->dd_fd, d->dd_sect);
-				while ( de = readdir(d) ) {
+				while ( (de = readdir(d)) ) {
 					filepos++;
 #ifdef DO_DEBUG
 // if (strlen(de->d_name) > 25) de->d_name[25] = 0;




More information about the Syslinux mailing list