summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Gnatenko <ignatenko@redhat.com>2016-04-29 13:00:30 +0200
committerIgor Gnatenko <ignatenko@redhat.com>2016-04-29 13:00:30 +0200
commit5f8b8ba3ea05cee52390a426d574e39a00831aa3 (patch)
treef4fb8199423b8dfed856d2fda5f4df06b47b5b72
parent35761ae1ef0d83189d2f3916620d59dee6648c7a (diff)
downloadgobject-introspection-5f8b8ba3ea05cee52390a426d574e39a00831aa3.tar.gz
fixup! g-ir-inspect: Inspect GI typelibs
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
-rw-r--r--tools/g-ir-inspect.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/g-ir-inspect.c b/tools/g-ir-inspect.c
index 8f6694ba..dc15bcb4 100644
--- a/tools/g-ir-inspect.c
+++ b/tools/g-ir-inspect.c
@@ -28,13 +28,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(GITypelib, g_typelib_free)
static void
print_shlibs (const gchar *namespace)
{
+ guint i = 0;
+
/* Finding the shared library we depend on (if any) */
const gchar *shlibs = g_irepository_get_shared_library (NULL, namespace);
if (shlibs && shlibs[0] != '\0')
{
/* shlibs is a comma-separated list of libraries */
g_auto(GStrv) libs = g_strsplit (shlibs, ",", -1);
- for (guint i = 0; libs[i]; i++)
+ for (i; libs[i]; i++)
g_print ("shlib: %s\n", libs[i]);
}
}
@@ -42,11 +44,13 @@ print_shlibs (const gchar *namespace)
static void
print_typelibs (const gchar *namespace)
{
+ guint i = 0;
+
/* Finding all the typelib-based Requires */
g_auto(GStrv) deps = g_irepository_get_dependencies (NULL, namespace);
if (deps)
{
- for (guint i = 0; deps[i]; i++)
+ for (i; deps[i]; i++)
g_print ("typelib: %s\n", deps[i]);
}
}
@@ -62,6 +66,7 @@ main (gint argc,
gboolean opt_shlibs = FALSE;
gboolean opt_typelibs = FALSE;
g_auto(GStrv) namespaces = NULL;
+ const gchar *namespace = NULL;
const GOptionEntry options[] = {
{ "version", 0, 0, G_OPTION_ARG_STRING, &version, "Version", "VERSION" },
{ "print-shlibs", 0, 0, G_OPTION_ARG_NONE, &opt_shlibs, "List the shared libraries the typelib requires" },
@@ -83,12 +88,13 @@ main (gint argc,
g_printerr ("Please specify at least one namespace\n");
return EXIT_FAILURE;
}
- else if (g_strv_length (namespaces) > 1)
+
+ if (g_strv_length (namespaces) > 1)
{
g_printerr ("Please specify only one namespace\n");
return EXIT_FAILURE;
}
- const gchar *namespace = namespaces[0];
+ namespace = namespaces[0];
if (!opt_shlibs && !opt_typelibs)
{