diff options
author | Johannes Berg <johannes.berg@intel.com> | 2013-04-05 20:02:55 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2013-04-05 20:03:08 +0200 |
commit | c5bec77577ca9f4e5dc2eec2919288236d9c26bc (patch) | |
tree | 889c687a877c0c3328c3c1b0c2b49d363b10b564 /lib | |
parent | d6ed4a46fec0fa02235f6a4e6ea2c27546c5f86d (diff) |
kconfig lib: make tree walking a generator
Instead of building the list in memory first, just
use a generator.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kconfig.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/kconfig.py b/lib/kconfig.py index 48226361..2369f746 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): |