From b7be018fba77db3a9ff11faf980c600d4bbb2fa8 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 14 Aug 2018 10:00:53 +0200 Subject: Use += instead of extend() += also does an in-place modification for lists, and it's a bit faster. Also get rid of an 'if node.defaults' tests. Both symbols and choices can have defaults, and it's not worthwhile as an optimization either. --- kconfiglib.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index 0732d14..ce2891f 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -2927,14 +2927,15 @@ class Kconfig(object): # See the Symbol class docstring sc.direct_dep = self._make_or(sc.direct_dep, node.dep) - if node.defaults: - sc.defaults.extend(node.defaults) + sc.defaults += node.defaults + + # The properties below aren't available on choices if node.ranges: - sc.ranges.extend(node.ranges) + sc.ranges += node.ranges if node.selects: - sc.selects.extend(node.selects) + sc.selects += node.selects # Modify the reverse dependencies of the selected symbol for target, cond in node.selects: @@ -2943,7 +2944,7 @@ class Kconfig(object): self._make_and(sc, cond)) if node.implies: - sc.implies.extend(node.implies) + sc.implies += node.implies # Modify the weak reverse dependencies of the implied # symbol -- cgit v1.2.3