all: use the elvis operator wherever possible

Coccinelle:

  @@
  expression a, b;
  @@
  -a ? a : b
  +a ?: b

Applied with:

  spatch --sp-file ternary.cocci --in-place --smpl-spacing --dir .

With some manual adjustments on spots that Cocci didn't catch for
reasons unknown.

Thanks to the marvelous effort of the GNU compiler developer we can now
spare a couple of bits that could be used for more important things,
like this commit message. Standards commitees yet have to catch up.
This commit is contained in:
Lubomir Rintel
2018-04-24 11:20:03 +02:00
parent f0c1efbf42
commit e69d386975
62 changed files with 139 additions and 141 deletions

View File

@@ -390,7 +390,7 @@ nmc_terminal_show_progress (const char *str)
const char slashes[4] = {'|', '/', '-', '\\'};
nmc_terminal_erase_line ();
g_print ("%c %s", slashes[idx++], str ? str : "");
g_print ("%c %s", slashes[idx++], str ?: "");
fflush (stdout);
if (idx == 4)
idx = 0;