]> sigrok.org Git - pulseview.git/commitdiff
DeviceManager: Minor tidyup in build_display_name
authorJoel Holdsworth <redacted>
Sat, 13 Dec 2014 10:16:17 +0000 (10:16 +0000)
committerJoel Holdsworth <redacted>
Sat, 13 Dec 2014 10:16:17 +0000 (10:16 +0000)
pv/devicemanager.cpp

index 7cb90bb8b9b8d9a964883b6f53d31c93071bbf3b..0c6c354fe6f12e14c06a7cfa955464b8049f4088 100644 (file)
@@ -209,17 +209,16 @@ void DeviceManager::build_display_name(shared_ptr<Device> 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<HardwareDevice> dev) {
+       const bool multiple_dev = hardware_device && any_of(
+               devices_.begin(), devices_.end(),
+               [&](shared_ptr<HardwareDevice> 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()};