From c5bec77577ca9f4e5dc2eec2919288236d9c26bc Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 5 Apr 2013 20:02:55 +0200 Subject: [PATCH] kconfig lib: make tree walking a generator Instead of building the list in memory first, just use a generator. Signed-off-by: Johannes Berg --- lib/kconfig.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/kconfig.py b/lib/kconfig.py index 48226361932b..2369f746fa8a 100644 --- a/lib/kconfig.py +++ b/lib/kconfig.py @@ -15,12 +15,12 @@ class ConfigTree(object): self.rootfile = os.path.basename(rootfile) def _walk(self, f): - list = [f] + yield f for l in open(os.path.join(self.basedir, f), 'r'): m = src_line.match(l) if m and os.path.exists(os.path.join(self.basedir, m.group('src'))): - list.extend(self._walk(m.group('src'))) - return list + for i in self._walk(m.group('src')): + yield i def _prune_sources(self, f, ignore): for nf in self._walk(f): -- 2.30.2