diff options
-rw-r--r-- | dive.c | 5 | ||||
-rw-r--r-- | divecomputer.cpp | 5 | ||||
-rw-r--r-- | qt-ui/divelistview.cpp | 4 | ||||
-rw-r--r-- | save-xml.c | 6 | ||||
-rw-r--r-- | statistics.c | 5 | ||||
-rw-r--r-- | uemis-downloader.c | 5 |
6 files changed, 9 insertions, 21 deletions
@@ -1320,11 +1320,8 @@ static void dc_cylinder_renumber(struct dive *dive, struct divecomputer *dc, int static void cylinder_renumber(struct dive *dive, int mapping[]) { struct divecomputer *dc; - - dc = &dive->dc; - do { + for_each_dc(dive, dc) dc_cylinder_renumber(dive, dc, mapping); - } while ((dc = dc->next) != NULL); } /* diff --git a/divecomputer.cpp b/divecomputer.cpp index 6044f1aa6..c714137a2 100644 --- a/divecomputer.cpp +++ b/divecomputer.cpp @@ -162,9 +162,9 @@ extern "C" void set_dc_nickname(struct dive *dive) if (!dive) return; - struct divecomputer *dc = &dive->dc; + struct divecomputer *dc; - while (dc) { + for_each_dc(dive, dc) { if (dc->model && *dc->model && dc->deviceid && !dcList.getExact(dc->model, dc->deviceid)) { // we don't have this one, yet @@ -181,6 +181,5 @@ extern "C" void set_dc_nickname(struct dive *dive) dcList.addDC(dc->model, dc->deviceid); } } - dc = dc->next; } } diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index c1d6e8d4d..07ce1f001 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -887,8 +887,7 @@ void DiveListView::loadImages() for_each_dive(j, dive) { if (!dive->selected) continue; - dc = &(dive->dc); - while (dc) { + for_each_dc(dive, dc) { when = dc->when ? dc->when : dive->when; duration_s = dc->duration.seconds ? dc->duration.seconds : dive->duration.seconds; if (when - 3600 < imagetime && when + duration_s + 3600 > imagetime) { @@ -909,7 +908,6 @@ void DiveListView::loadImages() MainWindow::instance()->refreshDisplay(); MainWindow::instance()->graphics()->replot(); } - dc = dc->next; } } } diff --git a/save-xml.c b/save-xml.c index ddaa8cd2a..e52cfdffd 100644 --- a/save-xml.c +++ b/save-xml.c @@ -392,12 +392,8 @@ void save_one_dive(struct membuffer *b, struct dive *dive) save_weightsystem_info(b, dive); save_dive_temperature(b, dive); /* Save the dive computer data */ - dc = &dive->dc; - do { + for_each_dc(dive, dc) save_dc(b, dive, dc); - dc = dc->next; - } while (dc); - put_format(b, "</dive>\n"); } diff --git a/statistics.c b/statistics.c index feb812766..71150159c 100644 --- a/statistics.c +++ b/statistics.c @@ -294,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) @@ -308,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; diff --git a/uemis-downloader.c b/uemis-downloader.c index 797704c66..5d8b07c01 100644 --- a/uemis-downloader.c +++ b/uemis-downloader.c @@ -795,13 +795,12 @@ static char *uemis_get_divenr(char *deviceidstr) deviceid = atoi(deviceidstr); struct dive *d; for_each_dive (i, d) { - struct divecomputer *dc = &d->dc; - while (dc) { + struct divecomputer *dc; + for_each_dc(d, dc) { if (dc->model && !strcmp(dc->model, "Uemis Zurich") && (dc->deviceid == 0 || dc->deviceid == 0x7fffffff || dc->deviceid == deviceid) && dc->diveid > maxdiveid) maxdiveid = dc->diveid; - dc = dc->next; } } snprintf(divenr, 10, "%d", maxdiveid); |