mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 04:36:17 +01:00
girwriter: Take the GIRepository as a parameter
We certainly won't find the requested namespace in a newly-created
repository with no typelibs loaded.
Fixes: 9ab84bc1
"girwriter: Stop using the singleton GIRepository"
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
b974fa4e50
commit
f80e978f00
@ -118,7 +118,7 @@ main (int argc, char *argv[])
|
|||||||
if (namespace == NULL)
|
if (namespace == NULL)
|
||||||
g_error ("failed to load typelib: %s", error->message);
|
g_error ("failed to load typelib: %s", error->message);
|
||||||
|
|
||||||
gi_ir_writer_write (output, namespace, needs_prefix, show_all);
|
gi_ir_writer_write (repository, output, namespace, needs_prefix, show_all);
|
||||||
|
|
||||||
/* when writing to stdout, stop after the first module */
|
/* when writing to stdout, stop after the first module */
|
||||||
if (input[i + 1] && !output)
|
if (input[i + 1] && !output)
|
||||||
|
@ -24,10 +24,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <girepository.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
void gi_ir_writer_write (const char *filename,
|
void gi_ir_writer_write (GIRepository *repository,
|
||||||
|
const char *filename,
|
||||||
const char *ns,
|
const char *ns,
|
||||||
gboolean needs_prefix,
|
gboolean needs_prefix,
|
||||||
gboolean show_all);
|
gboolean show_all);
|
||||||
|
@ -1319,6 +1319,7 @@ write_union_info (const char *ns,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* gi_ir_writer_write:
|
* gi_ir_writer_write:
|
||||||
|
* @repository: repository containing @ns
|
||||||
* @filename: (type filename): filename to write to
|
* @filename: (type filename): filename to write to
|
||||||
* @ns: GIR namespace to write
|
* @ns: GIR namespace to write
|
||||||
* @needs_prefix: if the filename needs prefixing
|
* @needs_prefix: if the filename needs prefixing
|
||||||
@ -1330,7 +1331,8 @@ write_union_info (const char *ns,
|
|||||||
* Since: 2.80
|
* Since: 2.80
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gi_ir_writer_write (const char *filename,
|
gi_ir_writer_write (GIRepository *repository,
|
||||||
|
const char *filename,
|
||||||
const char *ns,
|
const char *ns,
|
||||||
gboolean needs_prefix,
|
gboolean needs_prefix,
|
||||||
gboolean show_all)
|
gboolean show_all)
|
||||||
@ -1338,11 +1340,8 @@ gi_ir_writer_write (const char *filename,
|
|||||||
FILE *ofile;
|
FILE *ofile;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
char **dependencies;
|
char **dependencies;
|
||||||
GIRepository *repository = NULL;
|
|
||||||
Xml *xml;
|
Xml *xml;
|
||||||
|
|
||||||
repository = gi_repository_new ();
|
|
||||||
|
|
||||||
if (filename == NULL)
|
if (filename == NULL)
|
||||||
ofile = stdout;
|
ofile = stdout;
|
||||||
else
|
else
|
||||||
@ -1446,6 +1445,4 @@ gi_ir_writer_write (const char *filename,
|
|||||||
xml_end_element (xml, "repository");
|
xml_end_element (xml, "repository");
|
||||||
|
|
||||||
xml_free (xml);
|
xml_free (xml);
|
||||||
|
|
||||||
g_clear_object (&repository);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user