diff options
-rw-r--r-- | tools/g-ir-inspect.c | 14 |
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) { |