summaryrefslogtreecommitdiff
path: root/tools/compiler.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2010-07-14 11:59:11 -0400
committerColin Walters <walters@verbum.org>2010-07-14 11:59:11 -0400
commit05ffd85793207a40264a701de609614ba6e32d44 (patch)
tree166cff248bc9a8fba570b53b9738822d6f436635 /tools/compiler.c
parent30920a48928f158b25579e898f4b80b648ef2120 (diff)
downloadgobject-introspection-05ffd85793207a40264a701de609614ba6e32d44.tar.gz
[girepository] Actually verify header of loaded typelibs in g_irepository_require
Take a GError * for typelib loading code, validate the header. This fixes bizarre errors from gjs where g_irepository_require would happily load old typelibs.
Diffstat (limited to 'tools/compiler.c')
-rw-r--r--tools/compiler.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/compiler.c b/tools/compiler.c
index e6cddb81..d066428d 100644
--- a/tools/compiler.c
+++ b/tools/compiler.c
@@ -54,6 +54,7 @@ format_output (GTypelib *typelib)
result = g_string_sized_new (6 * typelib->len);
+ g_string_append_printf (result, "/* GENERATED CODE - DO NOT EDIT */\n");
g_string_append_printf (result, "#include <stdlib.h>\n");
g_string_append_printf (result, "#include <girepository.h>\n\n");
@@ -84,7 +85,8 @@ format_output (GTypelib *typelib)
"register_typelib (void)\n"
"{\n"
"\tGTypelib *typelib;\n"
- "\ttypelib = g_typelib_new_from_const_memory (_G_TYPELIB, _G_TYPELIB_SIZE);\n"
+ "\ttypelib = g_typelib_new_from_const_memory (_G_TYPELIB, _G_TYPELIB_SIZE, NULL);\n"
+ "\tg_assert (typelib != NULL);\n"
"\tg_irepository_load_typelib (NULL, typelib, G_IREPOSITORY_LOAD_FLAG_LAZY, NULL);\n"
"}\n\n");
}