mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-17 20:36:15 +00:00
cleanup: replace std::find_if by std::any_of
To search for devices with the same model, we used find_if(). However, that was only to check whether such a thing exists, not to actually do something with said device. Therefore, change this to std::any_of() to make it clear what the purpose of the statement is. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
8549f24c91
commit
0c769b04b7
1 changed files with 3 additions and 4 deletions
|
@ -314,10 +314,9 @@ extern "C" void set_dc_nickname(struct dive *dive, struct device_table *device_t
|
|||
if (!empty_string(dc->model) && dc->deviceid &&
|
||||
!get_device_for_dc(device_table, dc)) {
|
||||
// we don't have this one, yet
|
||||
auto it = std::find_if(device_table->devices.begin(), device_table->devices.end(),
|
||||
[dc] (const device &dev)
|
||||
{ return !strcasecmp(dev.model.c_str(), dc->model); });
|
||||
if (it != device_table->devices.end()) {
|
||||
if (std::any_of(device_table->devices.begin(), device_table->devices.end(),
|
||||
[dc] (const device &dev)
|
||||
{ return !strcasecmp(dev.model.c_str(), dc->model); })) {
|
||||
// we already have this model but a different deviceid
|
||||
std::string simpleNick(dc->model);
|
||||
if (dc->deviceid == 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue