static char *
locate_gir (GIrParser *parser,
- const char *name,
- const char *version)
+ const char *girname)
{
const gchar *const *datadirs;
const gchar *const *dir;
- char *girname;
char *path = NULL;
datadirs = g_get_system_data_dirs ();
- girname = g_strdup_printf ("%s-%s.gir", name, version);
-
if (parser->includes != NULL)
{
for (dir = (const gchar *const *)parser->includes; *dir; dir++)
g_free (path);
path = NULL;
}
- g_free (girname);
return path;
}
{
gchar *buffer;
gsize length;
- char *girpath;
+ gchar *girpath, *girname;
gboolean success = FALSE;
GList *modules;
GList *l;
}
}
- girpath = locate_gir (ctx->parser, name, version);
+ girname = g_strdup_printf ("%s-%s.gir", name, version);
+ girpath = locate_gir (ctx->parser, girname);
if (girpath == NULL)
{
g_set_error (error,
G_MARKUP_ERROR,
G_MARKUP_ERROR_INVALID_CONTENT,
- "Could not find GIR file '%s.gir'; check XDG_DATA_DIRS or use --includedir",
- name);
+ "Could not find GIR file '%s'; check XDG_DATA_DIRS or use --includedir",
+ girname);
+ g_free (girname);
return FALSE;
}
+ g_free (girname);
g_debug ("Parsing include %s", girpath);