Author: jensg Date: Sun Feb 17 21:27:43 2008 New Revision: 388 URL: http://svn.gnome.org/viewvc/gnome-main-menu?rev=388&view=rev
Log: 2008-02-17 Jens Granseuer <[EMAIL PROTECTED]> * slab-gnome-util.c: (get_slab_gconf_bool), (get_slab_gconf_int), (get_slab_gconf_string), (free_list_of_strings), (free_slab_gconf_slist_of_strings), (get_package_name_from_desktop_item): fix a few leaks and don't open-code g_(s)list_foreach Modified: trunk/libslab/ChangeLog trunk/libslab/slab-gnome-util.c Modified: trunk/libslab/slab-gnome-util.c ============================================================================== --- trunk/libslab/slab-gnome-util.c (original) +++ trunk/libslab/slab-gnome-util.c Sun Feb 17 21:27:43 2008 @@ -41,8 +41,12 @@ value = gconf_client_get_bool (gconf_client, key, &error); g_object_unref (gconf_client); + if (error) + { g_warning ("error accessing %s [%s]\n", key, error->message); + g_error_free (error); + } return value; } @@ -62,7 +66,10 @@ g_object_unref (gconf_client); if (error) + { g_warning ("error accessing %s [%s]\n", key, error->message); + g_error_free (error); + } return value; } @@ -82,7 +89,10 @@ g_object_unref (gconf_client); if (error) + { g_warning ("error accessing %s [%s]\n", key, error->message); + g_error_free (error); + } return value; } @@ -90,22 +100,16 @@ void free_list_of_strings (GList * string_list) { - GList * temp; - g_assert (string_list != NULL); - for(temp = string_list; temp; temp = temp->next) - g_free (temp->data); + g_list_foreach (string_list, (GFunc) g_free, NULL); g_list_free (string_list); } void free_slab_gconf_slist_of_strings (GSList * string_list) { - GSList * temp; - g_assert (string_list != NULL); - for(temp = string_list; temp; temp = temp->next) - g_free (temp->data); + g_slist_foreach (string_list, (GFunc) g_free, NULL); g_slist_free (string_list); } @@ -204,12 +208,11 @@ gchar * get_package_name_from_desktop_item (GnomeDesktopItem * desktop_item) { - gchar **argv; + gchar *argv[6]; gchar *package_name; gint retval; GError *error; - argv = g_new (gchar *, 6); argv[0] = "rpm"; argv[1] = "-qf"; argv[2] = "--qf"; @@ -223,14 +226,11 @@ &retval, &error)) { g_warning ("error: [%s]\n", error->message); + g_error_free (error); retval = -1; } g_free (argv[4]); - g_free (argv); - - if (error) - g_error_free (error); if (!retval) return package_name; _______________________________________________ SVN-commits-list mailing list (read only) http://mail.gnome.org/mailman/listinfo/svn-commits-list Want to limit the commits to a few modules? Go to above URL, log in to edit your options and select the modules ('topics') you want. Module maintainer? It is possible to set the reply-to to your development mailing list. Email [EMAIL PROTECTED] if interested.