Migrate code to for_each_dive and for_each_dc

[Dirk Hohndel: this overlapped with my commit 09e7c61fee ("Consistently
	       use for_each_dive (and use it correctly)") so I took the
	       pieces that I had missed]

Signed-off-by: Anton Lundin <glance@acc.umu.se>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Anton Lundin 2014-05-14 00:32:45 +02:00 committed by Dirk Hohndel
parent 91c20357f5
commit 05d9cc409c
6 changed files with 9 additions and 21 deletions

View file

@ -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;
}
}