mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-25 19:52:10 +01:00
Fix 'Could not find GIR file ...' error to use right filename.
Also plug a leak; girname was previously only freed on error.
This commit is contained in:
parent
7937dd000e
commit
c5930c73c5
18
girparser.c
18
girparser.c
@ -224,18 +224,14 @@ static GMarkupParser firstpass_parser =
|
|||||||
|
|
||||||
static char *
|
static char *
|
||||||
locate_gir (GIrParser *parser,
|
locate_gir (GIrParser *parser,
|
||||||
const char *name,
|
const char *girname)
|
||||||
const char *version)
|
|
||||||
{
|
{
|
||||||
const gchar *const *datadirs;
|
const gchar *const *datadirs;
|
||||||
const gchar *const *dir;
|
const gchar *const *dir;
|
||||||
char *girname;
|
|
||||||
char *path = NULL;
|
char *path = NULL;
|
||||||
|
|
||||||
datadirs = g_get_system_data_dirs ();
|
datadirs = g_get_system_data_dirs ();
|
||||||
|
|
||||||
girname = g_strdup_printf ("%s-%s.gir", name, version);
|
|
||||||
|
|
||||||
if (parser->includes != NULL)
|
if (parser->includes != NULL)
|
||||||
{
|
{
|
||||||
for (dir = (const gchar *const *)parser->includes; *dir; dir++)
|
for (dir = (const gchar *const *)parser->includes; *dir; dir++)
|
||||||
@ -255,7 +251,6 @@ locate_gir (GIrParser *parser,
|
|||||||
g_free (path);
|
g_free (path);
|
||||||
path = NULL;
|
path = NULL;
|
||||||
}
|
}
|
||||||
g_free (girname);
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2321,7 +2316,7 @@ parse_include (GMarkupParseContext *context,
|
|||||||
{
|
{
|
||||||
gchar *buffer;
|
gchar *buffer;
|
||||||
gsize length;
|
gsize length;
|
||||||
char *girpath;
|
gchar *girpath, *girname;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
GList *modules;
|
GList *modules;
|
||||||
GList *l;
|
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)
|
if (girpath == NULL)
|
||||||
{
|
{
|
||||||
g_set_error (error,
|
g_set_error (error,
|
||||||
G_MARKUP_ERROR,
|
G_MARKUP_ERROR,
|
||||||
G_MARKUP_ERROR_INVALID_CONTENT,
|
G_MARKUP_ERROR_INVALID_CONTENT,
|
||||||
"Could not find GIR file '%s.gir'; check XDG_DATA_DIRS or use --includedir",
|
"Could not find GIR file '%s'; check XDG_DATA_DIRS or use --includedir",
|
||||||
name);
|
girname);
|
||||||
|
g_free (girname);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
g_free (girname);
|
||||||
|
|
||||||
g_debug ("Parsing include %s", girpath);
|
g_debug ("Parsing include %s", girpath);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user