Commit dcbbf3bc authored by Stefan Behnel's avatar Stefan Behnel

remove unused condition

parent 6416103d
...@@ -1539,22 +1539,21 @@ class CCodeWriter(object): ...@@ -1539,22 +1539,21 @@ class CCodeWriter(object):
self.bol = 0 self.bol = 0
def put_or_include(self, code, name): def put_or_include(self, code, name):
if code: include_dir = self.globalstate.common_utility_include_dir
include_dir = self.globalstate.common_utility_include_dir if include_dir and len(code) > 1042:
if include_dir and len(code) > 1042: include_file = "%s_%s.h" % (
include_file = "%s_%s.h" % ( name, hashlib.md5(code).hexdigest())
name, hashlib.md5(code).hexdigest()) path = os.path.join(include_dir, include_file)
path = os.path.join(include_dir, include_file) if not os.path.exists(path):
if not os.path.exists(path): tmp_path = '%s.tmp%s' % (path, os.getpid())
tmp_path = '%s.tmp%s' % (path, os.getpid()) f = Utils.open_new_file(tmp_path)
f = Utils.open_new_file(tmp_path) try:
try: f.write(code)
f.write(code) finally:
finally: f.close()
f.close() os.rename(tmp_path, path)
os.rename(tmp_path, path) code = '#include "%s"\n' % path
code = '#include "%s"\n' % path self.put(code)
self.put(code)
def put(self, code): def put(self, code):
fix_indent = False fix_indent = False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment