Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Winship <danw@gnome.org>2009-03-28 12:34:36 (GMT)
committer Dan Winship <danw@gnome.org>2009-03-28 12:34:36 (GMT)
commiteeb9f501dc9ff1248782ef62b96cfa84dfd1274c (patch)
tree511d3061d34d87e447a5cb18352491b2db88947e
parent81d88917e17d91c4a807f68a4e8c8882f022f1cf (diff)
Fix 'Could not find GIR file ...' error to use right filename.
Also plug a leak; girname was previously only freed on error.
-rw-r--r--girepository/girparser.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 519c43c..2e8890e 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -224,18 +224,14 @@ static GMarkupParser firstpass_parser =
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++)
@@ -255,7 +251,6 @@ locate_gir (GIrParser *parser,
g_free (path);
path = NULL;
}
- g_free (girname);
return path;
}
@@ -2321,7 +2316,7 @@ parse_include (GMarkupParseContext *context,
{
gchar *buffer;
gsize length;
- char *girpath;
+ gchar *girpath, *girname;
gboolean success = FALSE;
GList *modules;
GList *l;
@@ -2350,17 +2345,20 @@ parse_include (GMarkupParseContext *context,
}
}
- 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);