diff options
Diffstat (limited to 'statistics.c')
-rw-r--r-- | statistics.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/statistics.c b/statistics.c index 2a96efb81..71150159c 100644 --- a/statistics.c +++ b/statistics.c @@ -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) { @@ -295,12 +294,12 @@ void get_selected_dives_text(char *buffer, int size) static bool is_gas_used(struct dive *dive, int idx) { - struct divecomputer *dc = &dive->dc; + struct divecomputer *dc; bool firstGasExplicit = false; if (cylinder_none(&dive->cylinder[idx])) return false; - while (dc) { + for_each_dc(dive, dc) { struct event *event = get_next_event(dc->events, "gaschange"); while (event) { if (event->time.seconds < 30) @@ -309,7 +308,6 @@ static bool is_gas_used(struct dive *dive, int idx) return true; event = get_next_event(event->next, "gaschange"); } - dc = dc->next; } if (idx == 0 && !firstGasExplicit) return true; |