summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2009-02-12 18:42:47 -0500
committerColin Walters <walters@verbum.org>2009-03-17 16:29:08 -0400
commit888566c41b4f0d73ec80307d0418ab1d44c7210c (patch)
treed144a6bcf51b7e92868de16797e164b85a5ccca1 /tools
parent5dfa997724551ed163fefc11782b7163db3be378 (diff)
downloadgobject-introspection-888566c41b4f0d73ec80307d0418ab1d44c7210c.tar.gz
Bug 564016 - Include c:prefix in typelib, use it to optimize find_by_gtype
Parse the c:prefix from the .gir, include it in the header. Armed with this information, we can now optimize lookups of GTypes because we have the requirement that GTypes must start with the c:prefix. We do fall back though if a lookup fails.
Diffstat (limited to 'tools')
-rw-r--r--tools/generate.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/generate.c b/tools/generate.c
index 48d7dfb6..f8767218 100644
--- a/tools/generate.c
+++ b/tools/generate.c
@@ -1282,16 +1282,20 @@ write_repository (const char *namespace,
if (TRUE)
{
const gchar *shared_library;
+ const gchar *c_prefix;
const char *ns = namespace;
const char *version;
version = g_irepository_get_version (repository, ns);
shared_library = g_irepository_get_shared_library (repository, ns);
+ c_prefix = g_irepository_get_c_prefix (repository, ns);
xml_start_element (xml, "namespace");
xml_printf (xml, " name=\"%s\" version=\"%s\"", ns, version);
if (shared_library)
xml_printf (xml, " shared-library=\"%s\"", shared_library);
+ if (c_prefix)
+ xml_printf (xml, " c:prefix=\"%s\"", c_prefix);
for (j = 0; j < g_irepository_get_n_infos (repository, ns); j++)
{