[PATCH 1/1] Cache the result of QTreeWidget::selectedItems()

From: Thiago Macieira
Date: Mon Nov 02 2015 - 11:55:56 EST


It's not a cheap function, so let's not call it twice.

Signed-off-by: Thiago Macieira <thiago.macieira@xxxxxxxxx>
---
scripts/kconfig/qconf.cc | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 91b7e6f..920a252 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -400,10 +400,11 @@ void ConfigList::updateSelection(void)
struct menu *menu;
enum prop_type type;

- if (selectedItems().count() == 0)
+ QList<QTreeWidgetItem *> items = selectedItems();
+ if (items.count() == 0)
return;

- ConfigItem* item = (ConfigItem*)selectedItems().first();
+ ConfigItem* item = (ConfigItem*)items.first();
if (!item)
return;

--
2.6.2


--nextPart1759666.Y5EAeU57h2--

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/