From 3bb590dc48f493b81775b377299823a5a314e01f Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Tue, 27 Feb 2018 13:45:51 +0100 Subject: Move sym._written setting earlier Makes the logic a bit clearer, and might save some branching. --- kconfiglib.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kconfiglib.py b/kconfiglib.py index c246cdc..b676d4e 100644 --- a/kconfiglib.py +++ b/kconfiglib.py @@ -849,6 +849,7 @@ class Kconfig(object): for sym in self.defined_syms: if not sym._written: + sym._written = True # Note: _write_to_conf is determined when the value is # calculated. This is a hidden function call due to # property magic. @@ -878,8 +879,6 @@ class Kconfig(object): 'header: unknown type "{}".' .format(sym.orig_type)) - sym._written = True - def write_config(self, filename, header="# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)\n"): r""" @@ -930,10 +929,10 @@ class Kconfig(object): item = node.item if isinstance(item, Symbol): if not item._written: + item._written = True config_string = item.config_string if config_string: write(config_string) - item._written = True elif expr_value(node.dep) and \ ((item == MENU and expr_value(node.visibility)) or -- cgit v1.2.3