Git fork

diff-delta: avoid using the comma operator

The comma operator is a somewhat obscure C feature that is often used by
mistake and can even cause unintentional code flow. That is why the
`-Wcomma` option of clang was introduced: To identify unintentional uses
of the comma operator.

Intentional uses include situations where one wants to avoid curly
brackets around multiple statements that need to be guarded by a
condition. This is the case here, as the repetitive nature of the
statements is easier to see for a human reader this way. At least in my
opinion.

However, opinions on this differ wildly, take 10 people and you have 10
different preferences.

On the Git mailing list, it seems that the consensus is to use the long
form instead, so let's do just that.

Suggested-by: Phillip Wood <phillip.wood123@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

authored by

Johannes Schindelin and committed by
Junio C Hamano
be7a517c 324fbaab

+24 -12
+24 -12
diff-delta.c
··· 438 438 op = out + outpos++; 439 439 i = 0x80; 440 440 441 - if (moff & 0x000000ff) 442 - out[outpos++] = moff >> 0, i |= 0x01; 443 - if (moff & 0x0000ff00) 444 - out[outpos++] = moff >> 8, i |= 0x02; 445 - if (moff & 0x00ff0000) 446 - out[outpos++] = moff >> 16, i |= 0x04; 447 - if (moff & 0xff000000) 448 - out[outpos++] = moff >> 24, i |= 0x08; 441 + if (moff & 0x000000ff) { 442 + out[outpos++] = moff >> 0; 443 + i |= 0x01; 444 + } 445 + if (moff & 0x0000ff00) { 446 + out[outpos++] = moff >> 8; 447 + i |= 0x02; 448 + } 449 + if (moff & 0x00ff0000) { 450 + out[outpos++] = moff >> 16; 451 + i |= 0x04; 452 + } 453 + if (moff & 0xff000000) { 454 + out[outpos++] = moff >> 24; 455 + i |= 0x08; 456 + } 449 457 450 - if (msize & 0x00ff) 451 - out[outpos++] = msize >> 0, i |= 0x10; 452 - if (msize & 0xff00) 453 - out[outpos++] = msize >> 8, i |= 0x20; 458 + if (msize & 0x00ff) { 459 + out[outpos++] = msize >> 0; 460 + i |= 0x10; 461 + } 462 + if (msize & 0xff00) { 463 + out[outpos++] = msize >> 8; 464 + i |= 0x20; 465 + } 454 466 455 467 *op = i; 456 468