summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 17:19:05 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2016-03-23 17:26:46 -0700
commit788d65a527b8daf511ca70c33b14bf88cf1a37b0 (patch)
tree2b42ea6142d7150e277e240b0ee5c746c821e3de
parent41bc8003d57e88590178ce0bce31406b718cc5ea (diff)
downloadsubsurface-788d65a527b8daf511ca70c33b14bf88cf1a37b0.tar.gz
Make code easier to read (and avoid warning)
The old expression wass correct because if dive_table.dives[j]->number is != 0, then !dive_table.dives[j]->number is 0 and vice versa. But come on... The new code seems much more natural and easier to read. And of course the Apple compilers by default gave a warning because they suspected a precedence bug with the old code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--subsurface-core/divelist.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/subsurface-core/divelist.c b/subsurface-core/divelist.c
index bac63ed97..99e09eab6 100644
--- a/subsurface-core/divelist.c
+++ b/subsurface-core/divelist.c
@@ -866,7 +866,7 @@ struct dive *merge_two_dives(struct dive *a, struct dive *b)
// renumber dives from merged one in advance by difference between
// merged dives numbers. Do not renumber if actual number is zero.
for (; j < dive_table.nr; j++)
- if (!dive_table.dives[j]->number == 0)
+ if (dive_table.dives[j]->number != 0)
dive_table.dives[j]->number -= factor;
mark_divelist_changed(true);