summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
authorUlf Magnusson <ulfalizer@gmail.com>2019-07-01 17:49:59 +0200
committerUlf Magnusson <ulfalizer@gmail.com>2019-07-01 23:46:24 +0200
commit8105b8b04cb1d90efaf7e0c20946c956ee85f5ed (patch)
tree6034f1e0691c1ad89c1f057488023d4f4e5595de /kconfiglib.py
parent4e2ac55f6de81f819268ba790b57282cb169a2e6 (diff)
Merge orig_type and _visited assignments in constructors
Small optimization. We know that UNKNOWN == 0, and it's always tested for by checking truthiness rather than identity within the library, so there can't be trouble even without small integer optimization.
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 1bbc24a..12471a9 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -4645,14 +4645,17 @@ class Symbol(object):
# rev_dep
# weak_rev_dep
- self.orig_type = UNKNOWN
+ # - UNKNOWN == 0
+ # - _visited is used during tree iteration and dep. loop detection
+ self.orig_type = self._visited = 0
+
+ self.nodes = []
+
self.defaults = []
self.selects = []
self.implies = []
self.ranges = []
- self.nodes = []
-
self.user_value = \
self.choice = \
self.env_var = \
@@ -4669,10 +4672,6 @@ class Symbol(object):
# See Kconfig._build_dep()
self._dependents = set()
- # Used during dependency loop detection and (independently) in
- # node_iter()
- self._visited = 0
-
def _assignable(self):
# Worker function for the 'assignable' attribute
@@ -5221,12 +5220,15 @@ class Choice(object):
# direct_dep
# kconfig
- self.orig_type = UNKNOWN
- self.syms = []
- self.defaults = []
+ # - UNKNOWN == 0
+ # - _visited is used during dep. loop detection
+ self.orig_type = self._visited = 0
self.nodes = []
+ self.syms = []
+ self.defaults = []
+
self.name = \
self.user_value = self.user_selection = \
self._cached_vis = self._cached_assignable = None
@@ -5240,9 +5242,6 @@ class Choice(object):
# See Kconfig._build_dep()
self._dependents = set()
- # Used during dependency loop detection
- self._visited = 0
-
def _assignable(self):
# Worker function for the 'assignable' attribute