From: Mark Wooding Date: Sun, 25 Dec 2011 23:55:59 +0000 (+0000) Subject: extract-profile.in: Allow empty sections. X-Git-Tag: 0.99.1~5 X-Git-Url: https://git.distorted.org.uk/~mdw/distorted-keys/commitdiff_plain/b5991f0555161e7baf665822dac54d493209dae2 extract-profile.in: Allow empty sections. Create a section as soon as we see a section header; we no longer need the more complicated lazy creation code. --- diff --git a/extract-profile.in b/extract-profile.in index dc816f3..918da8c 100755 --- a/extract-profile.in +++ b/extract-profile.in @@ -376,6 +376,8 @@ def parse(filename, d): continue if line[0] == '[' and line[-1] == ']': sect = line[1:-1] + if sect not in d: + d[sect] = Section(sect) continue ## Parse an assignment. @@ -393,12 +395,7 @@ def parse(filename, d): raise UserError, "%s:%d: bad name `%s'" % (filename, n, name) ## Store the assignment. - try: - d[sect][name] = value - except KeyError: - s = Section(sect) - d[sect] = s - s[name] = value + d[sect][name] = value ###-------------------------------------------------------------------------- ### Main program.