From 4ca8825e02ff8959e3790df2d7818ecfb4134963 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sun, 5 Jun 2022 13:29:38 +0200 Subject: Clean up Use gchar when memory is allocated through GLib. --- xdg.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'xdg.c') diff --git a/xdg.c b/xdg.c index 7ebd5de..503b9a1 100644 --- a/xdg.c +++ b/xdg.c @@ -21,7 +21,7 @@ /// defining is-a relations, and is traversed recursively. static void add_applying_transitive_closure( - const gchar *element, GHashTable *relation, GHashTable *output) + const char *element, GHashTable *relation, GHashTable *output) { // Stop condition. if (!g_hash_table_add(output, g_strdup(element))) @@ -61,7 +61,7 @@ get_xdg_data_dirs(void) GPtrArray *output = g_ptr_array_new_with_free_func(g_free); g_ptr_array_add(output, get_xdg_home_dir("XDG_DATA_HOME", ".local/share")); - const gchar *xdg_data_dirs; + const char *xdg_data_dirs; if (!(xdg_data_dirs = getenv("XDG_DATA_DIRS")) || !*xdg_data_dirs) xdg_data_dirs = "/usr/local/share/:/usr/share/"; @@ -82,7 +82,7 @@ get_xdg_data_dirs(void) // Derived from shared-mime-info-spec 0.21. static void -read_mime_subclasses(const gchar *path, GHashTable *subclass_sets) +read_mime_subclasses(const char *path, GHashTable *subclass_sets) { gchar *data = NULL; if (!g_file_get_contents(path, &data, NULL /* length */, NULL /* error */)) @@ -112,7 +112,7 @@ read_mime_subclasses(const gchar *path, GHashTable *subclass_sets) } static gboolean -filter_mime_globs(const gchar *path, guint is_globs2, GHashTable *supported_set, +filter_mime_globs(const char *path, guint is_globs2, GHashTable *supported_set, GHashTable *output_set) { gchar *data = NULL; @@ -120,7 +120,7 @@ filter_mime_globs(const gchar *path, guint is_globs2, GHashTable *supported_set, return FALSE; gchar *datasave = NULL; - for (const gchar *line = strtok_r(data, "\r\n", &datasave); line; + for (const char *line = strtok_r(data, "\r\n", &datasave); line; line = strtok_r(NULL, "\r\n", &datasave)) { if (*line == '#') continue; -- cgit v1.2.3