Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: 3.1.5-pws-4: compilation warnings



On Jan 20,  4:34pm, Peter Stephenson wrote:
} Subject: PATCH: 3.1.5-pws-4: compilation warnings
}
} One of the dangling `else' branches in hist.c actually appeared to be
} a bug, with the logic not agreeing with the indentation.

After staring at this for some time to try to figure out the run-time
consequences of this bug, I've concluded that it's not a bug after all.
The only problem is that one close brace is at the wrong indentation
level and that the following "else if" has been improperly "cuddled"
up against that brace.  Here's the code structure now:

	if (!*buf)
	    if (c != '%') {
	    	...
	    } else {
		...
	} else if ((t0 = atoi(buf))) {
	    ...
	} ...

Shuffle whitespace around the second close brace:

	if (!*buf)
	    if (c != '%') {
	    	...
	    } else {
		...
	    }
	else if ((t0 = atoi(buf))) {
	    ...
	} ...

Now it's clear that the code is doing the right thing, even though it
was misleadingly structured.  The patch to 3.0.5 that I just posted is
not necessary after all (though still probably advisable for the sake
of readability).

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author