chiark / gitweb /
make-secnet-sites: Introduce a couple of local variables
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 13:58:27 +0000 (14:58 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 24 Oct 2019 18:16:16 +0000 (19:16 +0100)
We are going to want these in a moment to avoid repeatedly referring
to the same w[] element.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
make-secnet-sites

index 1e6a65bd0c3da7f97cdfa33ad23a2c5beb825252..a24c06f6abe555e31902ffa83bc1b1c2b55040bd 100755 (executable)
@@ -177,7 +177,8 @@ class dhgroup (basetype):
 class hash (basetype):
        "A choice of hash function"
        def __init__(self,w):
-               self.ht=w[1]
+               hname=w[1]
+               self.ht=hname
                if (self.ht!='md5' and self.ht!='sha1'):
                        complain("unknown hash type %s"%(self.ht))
        def __str__(self):
@@ -405,10 +406,11 @@ prefix=''
 
 def set_property(obj,w):
        "Set a property on a configuration node"
-       if w[0] in obj.properties:
-               obj.properties[w[0]].add(obj,w)
+       prop=w[0]
+       if prop in obj.properties:
+               obj.properties[prop].add(obj,w)
        else:
-               obj.properties[w[0]]=keywords[w[0]][0](w)
+               obj.properties[prop]=keywords[prop][0](w)
 
 def pline(i,allow_include=False):
        "Process a configuration file line"
@@ -442,9 +444,10 @@ def pline(i,allow_include=False):
                # See if it's a new one (and whether that's permitted)
                # or an existing one
                current=obstack[len(obstack)-1]
-               if w[1] in current.children:
+               tname=w[1]
+               if tname in current.children:
                        # Not new
-                       current=current.children[w[1]]
+                       current=current.children[tname]
                        if service and group and current.depth==2:
                                if group!=current.group:
                                        complain("Incorrect group!")
@@ -457,7 +460,7 @@ def pline(i,allow_include=False):
                                        "level %d"%nl.depth)
                                # we risk crashing if we continue
                                sys.exit(1)
-                       current.children[w[1]]=nl
+                       current.children[tname]=nl
                        current=nl
                obstack.append(current)
                return [i]