mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: use getDiveSelection() to loop over selected dives
getDiveSelection() returns a vector of the selected dives. Use that instead of looping over the dive table and checking manually. This removes a few lines of code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
7b196a5ef9
commit
00abc04913
4 changed files with 18 additions and 53 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "subsurface-string.h"
|
||||
#include "device.h"
|
||||
#include "errorhelper.h" // for verbose flag
|
||||
#include "selection.h"
|
||||
#include "core/settings/qPrefDiveComputer.h"
|
||||
|
||||
/*
|
||||
|
@ -305,12 +306,8 @@ extern "C" void call_for_each_dc (void *f, void (*callback)(void *, const char *
|
|||
for (const DiveComputerNode &node : values) {
|
||||
bool found = false;
|
||||
if (select_only) {
|
||||
int j;
|
||||
struct dive *d;
|
||||
for_each_dive (j, d) {
|
||||
for (dive *d: getDiveSelection()) {
|
||||
struct divecomputer *dc;
|
||||
if (!d->selected)
|
||||
continue;
|
||||
for_each_dc (d, dc) {
|
||||
if (dc->deviceid == node.deviceId) {
|
||||
found = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue