summaryrefslogtreecommitdiff
path: root/kconfiglib.py
diff options
context:
space:
mode:
Diffstat (limited to 'kconfiglib.py')
-rw-r--r--kconfiglib.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/kconfiglib.py b/kconfiglib.py
index 5aaedcc..a01df27 100644
--- a/kconfiglib.py
+++ b/kconfiglib.py
@@ -1090,26 +1090,11 @@ class Kconfig(object):
for sym in self._defined_syms_set:
sym._written = False
- node = self.top_node.list
- if not node:
- # Empty configuration
- return
-
+ # The 'top_node' menu node itself doesn't generate any output, so
+ # it's skipped over below
+ node = self.top_node
while 1:
- item = node.item
- if isinstance(item, Symbol):
- if not item._written:
- item._written = True
- f.write(item.config_string)
-
- elif expr_value(node.dep) and \
- ((item == MENU and expr_value(node.visibility)) or
- item == COMMENT):
-
- f.write("\n#\n# {}\n#\n".format(node.prompt[0]))
-
- # Iterative tree walk using parent pointers
-
+ # Jump to the next node with an iterative tree walk
if node.list:
node = node.list
elif node.next:
@@ -1123,6 +1108,21 @@ class Kconfig(object):
else:
return
+ # Write node
+
+ item = node.item
+
+ if isinstance(item, Symbol):
+ if not item._written:
+ item._written = True
+ f.write(item.config_string)
+
+ elif expr_value(node.dep) and \
+ ((item == MENU and expr_value(node.visibility)) or
+ item == COMMENT):
+
+ f.write("\n#\n# {}\n#\n".format(node.prompt[0]))
+
def write_min_config(self, filename,
header="# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)\n"):
"""