From ab7fe62e65f363e6161534d58e8de7f98350f964 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=A3=CF=84=CE=AD=CF=86=CE=B1=CE=BD=CE=BF=CF=82?= Date: Tue, 4 Oct 2022 12:56:14 +0300 Subject: Fix variable initialization to 'auto' for getB() It does not make sense to return a `const bool&` as we are dealing with Boolean literals that are `prvalue`s of type bool. The compiler is smart enough to do the necessary optimizations wherever is applicable. --- src/freebsd/btop_collect.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/freebsd') diff --git a/src/freebsd/btop_collect.cpp b/src/freebsd/btop_collect.cpp index 9e5be73..bc01333 100644 --- a/src/freebsd/btop_collect.cpp +++ b/src/freebsd/btop_collect.cpp @@ -614,9 +614,9 @@ namespace Mem { if (Runner::stopping or (no_update and not current_mem.percent.at("used").empty())) return current_mem; - auto &show_swap = Config::getB("show_swap"); - auto &show_disks = Config::getB("show_disks"); - auto &swap_disk = Config::getB("swap_disk"); + auto show_swap = Config::getB("show_swap"); + auto show_disks = Config::getB("show_disks"); + auto swap_disk = Config::getB("swap_disk"); auto &mem = current_mem; static const bool snapped = (getenv("BTOP_SNAPPED") != NULL); @@ -670,7 +670,7 @@ namespace Mem { double uptime = system_uptime(); auto &disks_filter = Config::getS("disks_filter"); bool filter_exclude = false; - // auto &only_physical = Config::getB("only_physical"); + // auto only_physical = Config::getB("only_physical"); auto &disks = mem.disks; vector filter; if (not disks_filter.empty()) { @@ -806,8 +806,8 @@ namespace Net { auto collect(const bool no_update) -> net_info & { auto &net = current_net; auto &config_iface = Config::getS("net_iface"); - auto &net_sync = Config::getB("net_sync"); - auto &net_auto = Config::getB("net_auto"); + auto net_sync = Config::getB("net_sync"); + auto net_auto = Config::getB("net_auto"); auto new_timestamp = time_ms(); if (not no_update and errors < 3) { @@ -1080,11 +1080,11 @@ namespace Proc { //* Collects and sorts process information from /proc auto collect(const bool no_update) -> vector & { const auto &sorting = Config::getS("proc_sorting"); - const auto &reverse = Config::getB("proc_reversed"); + auto reverse = Config::getB("proc_reversed"); const auto &filter = Config::getS("proc_filter"); - const auto &per_core = Config::getB("proc_per_core"); - const auto &tree = Config::getB("proc_tree"); - const auto &show_detailed = Config::getB("show_detailed"); + auto per_core = Config::getB("proc_per_core"); + auto tree = Config::getB("proc_tree"); + auto show_detailed = Config::getB("show_detailed"); const size_t detailed_pid = Config::getI("detailed_pid"); bool should_filter = current_filter != filter; if (should_filter) current_filter = filter; -- cgit v1.2.3