From 7ddb8da6cae27c619644cd26cfbf8263d286f7a1 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 13 Dec 2014 10:16:17 +0000 Subject: [PATCH] DeviceManager: Minor tidyup in build_display_name --- pv/devicemanager.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pv/devicemanager.cpp b/pv/devicemanager.cpp index 7cb90bb8..0c6c354f 100644 --- a/pv/devicemanager.cpp +++ b/pv/devicemanager.cpp @@ -209,17 +209,16 @@ void DeviceManager::build_display_name(shared_ptr device) full_names_[device] = join(parts, " "); // Next, build the display name. It only contains fields as required. - bool multiple_dev = false; // If we can find another device with the same model/vendor then // we have at least two such devices and need to distinguish them. - if (hardware_device) - multiple_dev = any_of(devices_.begin(), devices_.end(), - [&](shared_ptr dev) { + const bool multiple_dev = hardware_device && any_of( + devices_.begin(), devices_.end(), + [&](shared_ptr dev) { return (dev->vendor() == hardware_device->vendor() && - dev->model() == hardware_device->model()) && - dev != hardware_device; - } ); + dev->model() == hardware_device->model()) && + dev != hardware_device; + } ); parts = {device->vendor(), device->model()}; -- 2.30.2