From: Joel Holdsworth Date: Sat, 13 Dec 2014 10:16:17 +0000 (+0000) Subject: DeviceManager: Minor tidyup in build_display_name X-Git-Tag: pulseview-0.3.0~364 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7ddb8da6cae27c619644cd26cfbf8263d286f7a1;p=pulseview.git DeviceManager: Minor tidyup in build_display_name --- 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()};