Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] blame.c: prepare_lines should not call xrealloc for every line

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:50

David Kastrup [off-list ref] writes:
Junio C Hamano [off-list ref] writes:
quoted
which I think is the prevalent style in our codebase.  The same for
the other loop we see in the new code below.

 - avoid assignments in conditionals when you do not have to.
commit a77a48c259d9adbe7779ca69a3432e493116b3fd
Author: Junio C Hamano [off-list ref]
Date:   Tue Jan 28 13:55:59 2014 -0800

    combine-diff: simplify intersect_paths() further
[...]

+       while ((p = *tail) != NULL) {

Because we can.
Be reasonable.  You cannot sensibly rewrite it to

	p = *tail;
        while (p) {
        	...
		p = *tail;
	}

when you do not know how ... part would evolve in the future.

	if ((p = *tail) != NULL) {
        	...

is a totally different issue.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help