Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-04-03 19:12:04 (GMT)
committer Colin Walters <walters@verbum.org>2009-04-03 19:15:29 (GMT)
commit89b28cf172ae9052f81ffd83f8cdfb5b034b5961 (patch)
treeef82b69f16a23004789578b7dc50c01301d283ca
parenteeb9f501dc9ff1248782ef62b96cfa84dfd1274c (diff)
Avoid writing out empty array if we have no _get_type functions
Zero length arrays are a GNU C extension, so this way we don't fail on non-GCC.
-rw-r--r--giscanner/dumper.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index c8f9927..8b85ae5 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -99,18 +99,18 @@ class DumpCompiler(object):
# We need to reference our get_type functions to make sure they are
# pulled in at the linking stage if the library is a static library
# rather than a shared library.
- for func in self._get_type_functions:
- f.write("extern GType " + func + "(void);\n")
- f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
- first = True
- for func in self._get_type_functions:
- if first:
- first = False
- else:
- f.write(",\n")
- f.write(" " + func)
- f.write("\n};\n")
-
+ if len(self._get_type_functions) > 0:
+ for func in self._get_type_functions:
+ f.write("extern GType " + func + "(void);\n")
+ f.write("GType (*GI_GET_TYPE_FUNCS_[])(void) = {\n")
+ first = True
+ for func in self._get_type_functions:
+ if first:
+ first = False
+ else:
+ f.write(",\n")
+ f.write(" " + func)
+ f.write("\n};\n")
f.close()
o_path = self._generate_tempfile('.o')