Consistently use for_each_dive (and use it correctly)

The way the macro is written there is no need to test the dive against
NULL before dereferencing.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-05-20 06:37:19 +09:00
parent b303f217a9
commit 09e7c61fee
5 changed files with 17 additions and 25 deletions

View file

@ -131,8 +131,7 @@ void process_all_dives(struct dive *dive, struct dive **prev_dive)
/* this relies on the fact that the dives in the dive_table
* are in chronological order */
for (idx = 0; idx < dive_table.nr; idx++) {
dp = dive_table.dives[idx];
for_each_dive (idx, dp) {
if (dive && dp->when == dive->when) {
/* that's the one we are showing */
if (idx > 0)
@ -230,10 +229,10 @@ static void get_ranges(char *buffer, int size)
{
int i, len;
int first = -1, last = -1;
struct dive *dive;
snprintf(buffer, size, "%s", translate("gettextFromC", "for dives #"));
for (i = 0; i < dive_table.nr; i++) {
struct dive *dive = get_dive(i);
for_each_dive (i, dive) {
if (!dive->selected)
continue;
if (dive->number < 1) {