# HG changeset patch
# Node ID e11671399e0b
# Parent  26ea8a6f26fb
diff --git a/gplugin-query/gplugin-query.c b/gplugin-query/gplugin-query.c
--- a/gplugin-query/gplugin-query.c
+++ b/gplugin-query/gplugin-query.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
+ * Copyright (C) 2011-2024 Gary Kramlich <grim@reaperworld.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -15,8 +15,6 @@
  * License along with this library; if not, see <https://www.gnu.org/licenses/>.
  */
 
-#include <stdio.h>
-#include <stdlib.h>
 #include <string.h>
 
 #include <glib.h>
@@ -37,8 +35,8 @@
  *****************************************************************************/
 static gboolean
 verbosity_cb(
-	G_GNUC_UNUSED const gchar *n,
-	G_GNUC_UNUSED const gchar *v,
+	G_GNUC_UNUSED const char *n,
+	G_GNUC_UNUSED const char *v,
 	G_GNUC_UNUSED gpointer d,
 	G_GNUC_UNUSED GError **e)
 {
@@ -49,8 +47,8 @@
 
 static gboolean
 full_verbosity_cb(
-	G_GNUC_UNUSED const gchar *n,
-	G_GNUC_UNUSED const gchar *v,
+	G_GNUC_UNUSED const char *n,
+	G_GNUC_UNUSED const char *v,
 	G_GNUC_UNUSED gpointer d,
 	G_GNUC_UNUSED GError **e)
 {
@@ -61,8 +59,8 @@
 
 static gboolean
 internal_cb(
-	G_GNUC_UNUSED const gchar *n,
-	G_GNUC_UNUSED const gchar *v,
+	G_GNUC_UNUSED const char *n,
+	G_GNUC_UNUSED const char *v,
 	G_GNUC_UNUSED gpointer d,
 	G_GNUC_UNUSED GError **e)
 {
@@ -73,12 +71,12 @@
 
 static gboolean
 version_cb(
-	G_GNUC_UNUSED const gchar *n,
-	G_GNUC_UNUSED const gchar *v,
+	G_GNUC_UNUSED const char *n,
+	G_GNUC_UNUSED const char *v,
 	G_GNUC_UNUSED gpointer d,
 	G_GNUC_UNUSED GError **e)
 {
-	printf("gplugin-query %s\n", GPLUGIN_VERSION);
+	g_print("gplugin-query %s\n", GPLUGIN_VERSION);
 
 	exit_early = TRUE;
 
@@ -87,8 +85,8 @@
 
 static gboolean
 list_cb(
-	G_GNUC_UNUSED const gchar *n,
-	G_GNUC_UNUSED const gchar *v,
+	G_GNUC_UNUSED const char *n,
+	G_GNUC_UNUSED const char *v,
 	G_GNUC_UNUSED gpointer d,
 	G_GNUC_UNUSED GError **e)
 {
@@ -98,7 +96,7 @@
 }
 
 static gboolean
-output_plugin(const gchar *id)
+output_plugin(const char *id)
 {
 	GPluginManager *manager = gplugin_manager_get_default();
 	GSList *plugins = NULL, *l = NULL;
@@ -111,7 +109,7 @@
 
 	plugins = gplugin_manager_find_plugins(manager, id);
 	if(plugins == NULL) {
-		printf("%s not found\n", id);
+		g_print("%s not found\n", id);
 
 		return FALSE;
 	}
@@ -121,19 +119,20 @@
 		GPluginPluginInfo *info = gplugin_plugin_get_info(plugin);
 		gboolean internal, loq, bind_global, unloadable;
 		guint32 abi_version;
-		gchar *name, *version;
-		gchar *license_id, *license_text, *license_url;
-		gchar *icon_name, *summary, *description, *category, *website;
-		gchar **authors, **dependencies;
+		char *name, *version;
+		char *license_id, *license_text, *license_url;
+		char *icon_name, *summary, *description, *category, *website;
+		char **authors, **dependencies;
 		gint i = 0;
 
 		internal = gplugin_plugin_info_get_internal(info);
 
-		if(!show_internal && internal)
+		if(!show_internal && internal) {
 			continue;
+		}
 
 		if(!header_output) {
-			printf("%s:\n", id);
+			g_print("%s:\n", id);
 			header_output = TRUE;
 		}
 
@@ -159,33 +158,36 @@
 			NULL);
 		/* clang-format on */
 
-		if(!first)
-			printf("\n");
+		if(!first) {
+			g_print("\n");
+		}
 
-		printf(MAIN_FORMAT, "name", STR_OR_EMPTY(name));
-		if(verbosity > 0)
-			printf(MAIN_FORMAT, "category", STR_OR_EMPTY(category));
-		printf(MAIN_FORMAT, "version", STR_OR_EMPTY(version));
+		g_print(MAIN_FORMAT, "name", STR_OR_EMPTY(name));
+		if(verbosity > 0) {
+			g_print(MAIN_FORMAT, "category", STR_OR_EMPTY(category));
+		}
+		g_print(MAIN_FORMAT, "version", STR_OR_EMPTY(version));
 		if(verbosity > 0) {
-			printf(MAIN_FORMAT, "license", STR_OR_EMPTY(license_id));
-			printf(MAIN_FORMAT, "license url", STR_OR_EMPTY(license_url));
+			g_print(MAIN_FORMAT, "license", STR_OR_EMPTY(license_id));
+			g_print(MAIN_FORMAT, "license url", STR_OR_EMPTY(license_url));
 		}
-		printf(MAIN_FORMAT, "summary", STR_OR_EMPTY(summary));
+		g_print(MAIN_FORMAT, "summary", STR_OR_EMPTY(summary));
 		if(verbosity > 0) {
-			printf(MAIN_FORMAT_NEL, "authors");
+			g_print(MAIN_FORMAT_NEL, "authors");
 			if(authors) {
 				for(i = 0; authors[i]; i++) {
-					if(i > 0)
-						printf("                 ");
-					printf("%s\n", STR_OR_EMPTY(authors[i]));
+					if(i > 0) {
+						g_print("                 ");
+					}
+					g_print("%s\n", STR_OR_EMPTY(authors[i]));
 				}
 			} else {
-				printf("\n");
+				g_print("\n");
 			}
-			printf(MAIN_FORMAT, "website", STR_OR_EMPTY(website));
+			g_print(MAIN_FORMAT, "website", STR_OR_EMPTY(website));
 		}
 		if(verbosity > 1) {
-			printf(
+			g_print(
 				MAIN_FORMAT,
 				"filename",
 				STR_OR_EMPTY(gplugin_plugin_get_filename(plugin)));
@@ -193,27 +195,29 @@
 		if(verbosity > 2) {
 			GPluginLoader *loader = gplugin_plugin_get_loader(plugin);
 
-			printf(MAIN_FORMAT_NEL "%08x\n", "abi version", abi_version);
-			printf(MAIN_FORMAT, "internal", (internal) ? "yes" : "no");
-			printf(MAIN_FORMAT, "load on query", (loq) ? "yes" : "no");
-			printf(MAIN_FORMAT, "bind globally", (bind_global) ? "yes" : "no");
-			printf(MAIN_FORMAT, "unloadable", (unloadable) ? "yes" : "no");
-			printf(MAIN_FORMAT, "loader", G_OBJECT_TYPE_NAME(loader));
+			g_print(MAIN_FORMAT_NEL "%08x\n", "abi version", abi_version);
+			g_print(MAIN_FORMAT, "internal", (internal) ? "yes" : "no");
+			g_print(MAIN_FORMAT, "load on query", (loq) ? "yes" : "no");
+			g_print(MAIN_FORMAT, "bind globally", (bind_global) ? "yes" : "no");
+			g_print(MAIN_FORMAT, "unloadable", (unloadable) ? "yes" : "no");
+			g_print(MAIN_FORMAT, "loader", G_OBJECT_TYPE_NAME(loader));
 
 			g_object_unref(loader);
 		}
-		if(verbosity > 0)
-			printf(MAIN_FORMAT, "description", STR_OR_EMPTY(description));
+		if(verbosity > 0) {
+			g_print(MAIN_FORMAT, "description", STR_OR_EMPTY(description));
+		}
 		if(verbosity > 2) {
-			printf(MAIN_FORMAT_NEL, "dependencies");
+			g_print(MAIN_FORMAT_NEL, "dependencies");
 			if(dependencies) {
 				for(i = 0; dependencies[i]; i++) {
-					if(i > 0)
-						printf("                 ");
-					printf("%s\n", STR_OR_EMPTY(dependencies[i]));
+					if(i > 0) {
+						g_print("                 ");
+					}
+					g_print("%s\n", STR_OR_EMPTY(dependencies[i]));
 				}
 			} else {
-				printf("\n");
+				g_print("\n");
 			}
 		}
 
@@ -231,8 +235,9 @@
 		g_strfreev(dependencies);
 		g_object_unref(info);
 
-		if(first)
+		if(first) {
 			first = FALSE;
+		}
 	}
 
 	g_slist_free_full(plugins, g_object_unref);
@@ -247,14 +252,17 @@
 	gboolean ret = TRUE, first = TRUE;
 
 	for(l = plugins; l; l = l->next) {
-		if(!first)
-			printf("\n");
+		if(!first) {
+			g_print("\n");
+		}
 
-		if(!output_plugin(l->data))
+		if(!output_plugin(l->data)) {
 			ret = FALSE;
+		}
 
-		if(first)
+		if(first) {
 			first = FALSE;
+		}
 	}
 
 	return ret;
@@ -292,7 +300,7 @@
 /* clang-format on */
 
 gint
-main(gint argc, gchar **argv)
+main(gint argc, char **argv)
 {
 	GPluginManager *manager = NULL;
 	GError *error = NULL;
@@ -312,7 +320,7 @@
 	g_option_context_free(ctx);
 
 	if(error) {
-		fprintf(stderr, "%s\n", error->message);
+		g_printerr("%s\n", error->message);
 
 		g_error_free(error);
 
@@ -336,7 +344,7 @@
 
 		for(path = gplugin_manager_get_paths(manager); path;
 			path = path->next) {
-			printf("%s\n", (gchar *)path->data);
+			g_print("%s\n", (char *)path->data);
 		}
 
 		exit_early = TRUE;
@@ -355,24 +363,28 @@
 		GQueue *plugins = g_queue_new();
 
 		for(i = 1; i < argc; i++) {
-			if(!argv[i])
+			if(!argv[i]) {
 				continue;
+			}
 
-			if(strlen(argv[i]) == 0)
+			if(strlen(argv[i]) == 0) {
 				continue;
+			}
 
 			g_queue_push_tail(plugins, argv[i]);
 		}
 
-		if(!output_plugins(plugins->head))
+		if(!output_plugins(plugins->head)) {
 			ret = EXIT_FAILURE;
+		}
 
 		g_queue_free(plugins);
 	} else {
 		GList *plugins = gplugin_manager_list_plugins(manager);
 
-		if(!output_plugins(plugins))
+		if(!output_plugins(plugins)) {
 			ret = EXIT_FAILURE;
+		}
 
 		g_list_free(plugins);
 	}
