[gnome-software] Use GLib's cleanup functions instead of libgsystem's
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Use GLib's cleanup functions instead of libgsystem's
- Date: Tue, 8 Sep 2015 01:05:58 +0000 (UTC)
commit 45293d587e29fe464fc4f2218eb8f164689b7093
Author: Kalev Lember <klember redhat com>
Date: Mon Sep 7 22:01:30 2015 +0200
Use GLib's cleanup functions instead of libgsystem's
We still have a few types that don't support g_autoptr(), but very very
close to having everything ported over.
src/gs-app-addon-row.c | 2 +-
src/gs-app-folder-dialog.c | 4 +-
src/gs-app-row.c | 6 +-
src/gs-app-tile.c | 2 +-
src/gs-app.c | 4 +-
src/gs-application.c | 18 ++--
src/gs-box.c | 2 +-
src/gs-cleanup.h | 33 --------
src/gs-cmd.c | 26 +++---
src/gs-dbus-helper.c | 26 +++---
src/gs-feature-tile.c | 4 +-
src/gs-folders.c | 34 ++++----
src/gs-history-dialog.c | 4 +-
src/gs-main.c | 4 +-
src/gs-markdown.c | 24 +++---
src/gs-page.c | 4 +-
src/gs-plugin-loader.c | 90 ++++++++++----------
src/gs-plugin.c | 14 ++--
src/gs-popular-tile.c | 2 +-
src/gs-profile.c | 4 +-
src/gs-proxy-settings.c | 14 ++--
src/gs-screenshot-image.c | 24 +++---
src/gs-self-test.c | 28 +++---
src/gs-shell-category.c | 6 +-
src/gs-shell-details.c | 30 ++++----
src/gs-shell-extras.c | 72 ++++++++--------
src/gs-shell-installed.c | 34 ++++----
src/gs-shell-overview.c | 14 ++--
src/gs-shell-search-provider.c | 8 +-
src/gs-shell-search.c | 6 +-
src/gs-shell-updates.c | 32 ++++----
src/gs-shell.c | 6 +-
src/gs-sources-dialog.c | 16 ++--
src/gs-update-dialog.c | 14 ++--
src/gs-update-list.c | 6 +-
src/gs-update-monitor.c | 18 ++--
src/gs-utils.c | 20 +++---
src/plugins/gs-moduleset.c | 8 +-
src/plugins/gs-plugin-appstream.c | 26 +++---
src/plugins/gs-plugin-epiphany.c | 42 +++++-----
src/plugins/gs-plugin-fedora-tagger-ratings.c | 24 +++---
src/plugins/gs-plugin-fedora-tagger-usage.c | 6 +-
src/plugins/gs-plugin-fwupd.c | 108 ++++++++++++------------
src/plugins/gs-plugin-hardcoded-featured.c | 16 ++--
src/plugins/gs-plugin-icons.c | 6 +-
src/plugins/gs-plugin-limba.c | 4 +-
src/plugins/gs-plugin-local-ratings.c | 4 +-
src/plugins/gs-plugin-menu-spec-categories.c | 2 +-
src/plugins/gs-plugin-menu-spec-refine.c | 4 +-
src/plugins/gs-plugin-moduleset.c | 20 +++---
src/plugins/gs-plugin-packagekit-history.c | 12 ++--
src/plugins/gs-plugin-packagekit-offline.c | 12 ++--
src/plugins/gs-plugin-packagekit-refine.c | 30 ++++----
src/plugins/gs-plugin-packagekit-refresh.c | 18 ++--
src/plugins/gs-plugin-packagekit.c | 16 ++--
src/plugins/gs-plugin-systemd-updates.c | 8 +-
src/plugins/gs-self-test.c | 2 +-
src/plugins/packagekit-common.c | 8 +-
58 files changed, 499 insertions(+), 532 deletions(-)
---
diff --git a/src/gs-app-addon-row.c b/src/gs-app-addon-row.c
index 20e317b..e7d2dba 100644
--- a/src/gs-app-addon-row.c
+++ b/src/gs-app-addon-row.c
@@ -56,7 +56,7 @@ static GString *
gs_app_addon_row_get_summary (GsAppAddonRow *row)
{
const gchar *tmp = NULL;
- _cleanup_free_ gchar *escaped = NULL;
+ g_autofree gchar *escaped = NULL;
/* try all these things in order */
if (gs_app_get_kind (row->app) == GS_APP_KIND_MISSING)
diff --git a/src/gs-app-folder-dialog.c b/src/gs-app-folder-dialog.c
index b5fccfc..a31f5d7 100644
--- a/src/gs-app-folder-dialog.c
+++ b/src/gs-app-folder-dialog.c
@@ -204,7 +204,7 @@ static void
populate_list (GsAppFolderDialog *dialog)
{
guint i;
- _cleanup_free_ gchar **folders = NULL;
+ g_autofree gchar **folders = NULL;
folders = gs_folders_get_nonempty_folders (dialog->folders);
for (i = 0; folders[i]; i++) {
@@ -290,7 +290,7 @@ static void
create_folder_name_popover (GsAppFolderDialog *dialog)
{
GtkWidget *grid, *label, *button;
- _cleanup_free_ gchar *title = NULL;
+ g_autofree gchar *title = NULL;
dialog->new_folder_popover = gtk_popover_new (GTK_WIDGET (dialog->new_folder_button));
gtk_popover_set_position (GTK_POPOVER (dialog->new_folder_popover), GTK_POS_TOP);
diff --git a/src/gs-app-row.c b/src/gs-app-row.c
index f17a5d7..511a4b1 100644
--- a/src/gs-app-row.c
+++ b/src/gs-app-row.c
@@ -80,14 +80,14 @@ gs_app_row_get_description (GsAppRow *app_row)
{
GsAppRowPrivate *priv = gs_app_row_get_instance_private (app_row);
const gchar *tmp = NULL;
- _cleanup_free_ gchar *escaped = NULL;
+ g_autofree gchar *escaped = NULL;
/* convert the markdown update description into PangoMarkup */
if (priv->show_update &&
gs_app_get_state (priv->app) == AS_APP_STATE_UPDATABLE) {
tmp = gs_app_get_update_details (priv->app);
if (tmp != NULL && tmp[0] != '\0') {
- _cleanup_object_unref_ GsMarkdown *markdown = NULL;
+ g_autoptr(GsMarkdown) markdown = NULL;
markdown = gs_markdown_new (GS_MARKDOWN_OUTPUT_PANGO);
gs_markdown_set_smart_quoting (markdown, FALSE);
gs_markdown_set_autocode (markdown, FALSE);
@@ -174,7 +174,7 @@ gs_app_row_refresh (GsAppRow *app_row)
if (priv->show_update || priv->show_codec) {
gtk_widget_hide (priv->folder_label);
} else {
- _cleanup_object_unref_ GsFolders *folders = NULL;
+ g_autoptr(GsFolders) folders = NULL;
const gchar *folder;
folders = gs_folders_get ();
folder = gs_folders_get_app_folder (folders, gs_app_get_id (priv->app), gs_app_get_categories
(priv->app));
diff --git a/src/gs-app-tile.c b/src/gs-app-tile.c
index 9f72ff9..9734d4c 100644
--- a/src/gs-app-tile.c
+++ b/src/gs-app-tile.c
@@ -59,7 +59,7 @@ app_state_changed_idle (gpointer user_data)
AtkObject *accessible;
GtkWidget *label;
gboolean installed;
- _cleanup_free_ gchar *name = NULL;
+ g_autofree gchar *name = NULL;
accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
diff --git a/src/gs-app.c b/src/gs-app.c
index c84c251..a988ea1 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -945,7 +945,7 @@ gboolean
gs_app_load_icon (GsApp *app, gint scale, GError **error)
{
AsIcon *icon;
- _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
g_return_val_if_fail (GS_IS_APP (app), FALSE);
g_return_val_if_fail (app->icon != NULL, FALSE);
@@ -1278,7 +1278,7 @@ gs_app_set_licence (GsApp *app, const gchar *licence)
{
GString *urld;
guint i;
- _cleanup_strv_free_ gchar **tokens = NULL;
+ g_auto(GStrv) tokens = NULL;
g_return_if_fail (GS_IS_APP (app));
diff --git a/src/gs-application.c b/src/gs-application.c
index 931459c..c3a54b3 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -182,7 +182,7 @@ static void
gs_application_initialize_plugins (GsApplication *app)
{
static gboolean initialized = FALSE;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (initialized)
return;
@@ -247,8 +247,8 @@ gs_application_show_first_run_dialog (GsApplication *app)
static void
theme_changed (GtkSettings *settings, GParamSpec *pspec, GsApplication *app)
{
- _cleanup_object_unref_ GFile *file = NULL;
- _cleanup_free_ gchar *theme = NULL;
+ g_autoptr(GFile) file = NULL;
+ g_autofree gchar *theme = NULL;
g_object_get (settings, "gtk-theme-name", &theme, NULL);
if (g_strcmp0 (theme, "HighContrast") == 0) {
@@ -366,7 +366,7 @@ profile_activated (GSimpleAction *action,
static void
offline_updates_cancel (void)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!pk_offline_cancel (NULL, &error))
g_warning ("failed to cancel the offline update: %s", error->message);
}
@@ -379,7 +379,7 @@ offline_update_cb (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GsApplication *app)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!gs_plugin_loader_offline_update_finish (plugin_loader, res, &error)) {
g_warning ("Failed to trigger offline update: %s", error->message);
return;
@@ -503,9 +503,9 @@ launch_activated (GSimpleAction *action,
{
const gchar *desktop_id;
GdkDisplay *display;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_object_unref_ GAppInfo *appinfo = NULL;
- _cleanup_object_unref_ GAppLaunchContext *context = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GAppInfo) appinfo = NULL;
+ g_autoptr(GAppLaunchContext) context = NULL;
desktop_id = g_variant_get_string (parameter, NULL);
display = gdk_display_get_default ();
@@ -639,7 +639,7 @@ gs_application_handle_local_options (GApplication *app, GVariantDict *options)
const gchar *local_filename;
const gchar *mode;
const gchar *search;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (g_variant_dict_contains (options, "verbose"))
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
diff --git a/src/gs-box.c b/src/gs-box.c
index f6e33c5..6a14049 100644
--- a/src/gs-box.c
+++ b/src/gs-box.c
@@ -130,7 +130,7 @@ gs_box_get_preferred_width (GtkWidget *widget, gint *min, gint *nat)
gint ms, m, n;
GList *l;
gint i;
- _cleanup_free_ gint *cn = NULL;
+ g_autofree gint *cn = NULL;
n_children = g_list_length (box->children);
diff --git a/src/gs-cleanup.h b/src/gs-cleanup.h
index 461c871..186dea4 100644
--- a/src/gs-cleanup.h
+++ b/src/gs-cleanup.h
@@ -47,48 +47,15 @@ G_BEGIN_DECLS
func (*(Type*)v, TRUE); \
}
-GS_DEFINE_CLEANUP_FUNCTION0(GArray*, gs_local_array_unref, g_array_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GBytes*, gs_local_bytes_unref, g_bytes_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GChecksum*, gs_local_checksum_free, g_checksum_free)
-GS_DEFINE_CLEANUP_FUNCTION0(GDateTime*, gs_local_date_time_unref, g_date_time_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GDir*, gs_local_dir_close, g_dir_close)
-GS_DEFINE_CLEANUP_FUNCTION0(GError*, gs_local_free_error, g_error_free)
-GS_DEFINE_CLEANUP_FUNCTION0(GHashTable*, gs_local_hashtable_unref, g_hash_table_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GKeyFile*, gs_local_keyfile_unref, g_key_file_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GMarkupParseContext*, gs_local_markup_parse_context_unref,
g_markup_parse_context_unref)
GS_DEFINE_CLEANUP_FUNCTION0(GObject*, gs_local_obj_unref, g_object_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GPtrArray*, gs_local_ptrarray_unref, g_ptr_array_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GTimer*, gs_local_destroy_timer, g_timer_destroy)
-GS_DEFINE_CLEANUP_FUNCTION0(GVariantBuilder*, gs_local_variant_builder_unref, g_variant_builder_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GVariant*, gs_local_variant_unref, g_variant_unref)
-GS_DEFINE_CLEANUP_FUNCTION0(GVariantIter*, gs_local_variant_iter_free, g_variant_iter_free)
GS_DEFINE_CLEANUP_FUNCTIONt(GString*, gs_local_free_string, g_string_free)
-GS_DEFINE_CLEANUP_FUNCTION(char**, gs_local_strfreev, g_strfreev)
-GS_DEFINE_CLEANUP_FUNCTION(GList*, gs_local_free_list, g_list_free)
GS_DEFINE_CLEANUP_FUNCTION(GList*, gs_local_free_plugin_list, gs_plugin_list_free)
-GS_DEFINE_CLEANUP_FUNCTION(void*, gs_local_free, g_free)
-#define _cleanup_dir_close_ __attribute__ ((cleanup(gs_local_dir_close)))
-#define _cleanup_timer_destroy_ __attribute__ ((cleanup(gs_local_destroy_timer)))
-#define _cleanup_free_ __attribute__ ((cleanup(gs_local_free)))
-#define _cleanup_checksum_free_ __attribute__ ((cleanup(gs_local_checksum_free)))
-#define _cleanup_date_time_unref_ __attribute__ ((cleanup(gs_local_date_time_unref)))
-#define _cleanup_error_free_ __attribute__ ((cleanup(gs_local_free_error)))
-#define _cleanup_list_free_ __attribute__ ((cleanup(gs_local_free_list)))
#define _cleanup_plugin_list_free_ __attribute__ ((cleanup(gs_local_free_plugin_list)))
#define _cleanup_string_free_ __attribute__ ((cleanup(gs_local_free_string)))
-#define _cleanup_strv_free_ __attribute__ ((cleanup(gs_local_strfreev)))
-#define _cleanup_variant_iter_free_ __attribute__ ((cleanup(gs_local_variant_iter_free)))
-#define _cleanup_array_unref_ __attribute__ ((cleanup(gs_local_array_unref)))
-#define _cleanup_bytes_unref_ __attribute__ ((cleanup(gs_local_bytes_unref)))
-#define _cleanup_hashtable_unref_ __attribute__ ((cleanup(gs_local_hashtable_unref)))
-#define _cleanup_keyfile_unref_ __attribute__ ((cleanup(gs_local_keyfile_unref)))
-#define _cleanup_markup_parse_context_unref_ __attribute__ ((cleanup(gs_local_markup_parse_context_unref)))
#define _cleanup_object_unref_ __attribute__ ((cleanup(gs_local_obj_unref)))
-#define _cleanup_ptrarray_unref_ __attribute__ ((cleanup(gs_local_ptrarray_unref)))
-#define _cleanup_variant_unref_ __attribute__ ((cleanup(gs_local_variant_unref)))
G_END_DECLS
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index bfab5a8..7747a78 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -43,13 +43,13 @@ gs_cmd_show_results_apps (GList *list)
guint i;
for (l = list; l != NULL; l = l->next) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
app = GS_APP (l->data);
tmp = gs_app_to_string (app);
g_print ("%s\n", tmp);
related = gs_app_get_related (app);
for (i = 0; i < related->len; i++) {
- _cleanup_free_ gchar *tmp_rel = NULL;
+ g_autofree gchar *tmp_rel = NULL;
app_rel = GS_APP (g_ptr_array_index (related, i));
tmp_rel = gs_app_to_string (app_rel);
g_print ("\t%s\n", tmp_rel);
@@ -84,11 +84,11 @@ gs_cmd_show_results_categories (GList *list)
GsCategory *parent;
for (l = list; l != NULL; l = l->next) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
cat = GS_CATEGORY (l->data);
parent = gs_category_get_parent (cat);
if (parent != NULL){
- _cleanup_free_ gchar *id = NULL;
+ g_autofree gchar *id = NULL;
id = g_strdup_printf ("%s/%s",
gs_category_get_id (parent),
gs_category_get_id (cat));
@@ -153,7 +153,7 @@ gs_cmd_parse_refine_flags (const gchar *extra, GError **error)
GsPluginRefineFlags tmp;
guint i;
guint64 refine_flags = GS_PLUGIN_REFINE_FLAGS_DEFAULT;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_auto(GStrv) split = NULL;
if (extra == NULL)
return GS_PLUGIN_REFINE_FLAGS_DEFAULT;
@@ -181,11 +181,11 @@ main (int argc, char **argv)
gint i;
gint repeat = 1;
int status = 0;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_free_ gchar *refine_flags_str = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_object_unref_ GsPluginLoader *plugin_loader = NULL;
- _cleanup_object_unref_ GsProfile *profile = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *refine_flags_str = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_autoptr(GsPluginLoader) plugin_loader = NULL;
+ g_autoptr(GsProfile) profile = NULL;
const GOptionEntry options[] = {
{ "show-results", '\0', 0, G_OPTION_ARG_NONE, &show_results,
"Show the results for the action", NULL },
@@ -351,13 +351,13 @@ main (int argc, char **argv)
}
}
} else if (argc == 3 && g_strcmp0 (argv[1], "get-category-apps") == 0) {
- _cleanup_object_unref_ GsCategory *category = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_autoptr(GsCategory) category = NULL;
+ g_auto(GStrv) split = NULL;
split = g_strsplit (argv[2], "/", 2);
if (g_strv_length (split) == 1) {
category = gs_category_new (NULL, split[0], NULL);
} else {
- _cleanup_object_unref_ GsCategory *parent = NULL;
+ g_autoptr(GsCategory) parent = NULL;
parent = gs_category_new (NULL, split[0], NULL);
category = gs_category_new (parent, split[1], NULL);
}
diff --git a/src/gs-dbus-helper.c b/src/gs-dbus-helper.c
index 12ff95b..df60eba 100644
--- a/src/gs-dbus-helper.c
+++ b/src/gs-dbus-helper.c
@@ -76,7 +76,7 @@ static void
gs_dbus_helper_task_set_interaction (GsDbusHelperTask *dtask, const gchar *interaction)
{
guint i;
- _cleanup_strv_free_ gchar **interactions = NULL;
+ g_auto(GStrv) interactions = NULL;
interactions = g_strsplit (interaction, ",", -1);
for (i = 0; interactions[i] != NULL; i++) {
@@ -123,10 +123,10 @@ gs_dbus_helper_query_is_installed_cb (GObject *source, GAsyncResult *res, gpoint
{
GsDbusHelperTask *dtask = (GsDbusHelperTask *) data;
PkClient *client = PK_CLIENT (source);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array = NULL;
/* get the results */
results = pk_client_generic_finish (client, res, &error);
@@ -165,12 +165,12 @@ out:
static void
gs_dbus_helper_query_search_file_cb (GObject *source, GAsyncResult *res, gpointer data)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
GsDbusHelperTask *dtask = (GsDbusHelperTask *) data;
PkClient *client = PK_CLIENT (source);
PkInfoEnum info;
PkPackage *item;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
@@ -225,7 +225,7 @@ handle_query_search_file (GsPackageKitQuery *skeleton,
{
GsDbusHelper *dbus_helper = user_data;
GsDbusHelperTask *dtask;
- _cleanup_strv_free_ gchar **names = NULL;
+ g_auto(GStrv) names = NULL;
g_debug ("****** SearchFile");
@@ -252,7 +252,7 @@ handle_query_is_installed (GsPackageKitQuery *skeleton,
{
GsDbusHelper *dbus_helper = user_data;
GsDbusHelperTask *dtask;
- _cleanup_strv_free_ gchar **names = NULL;
+ g_auto(GStrv) names = NULL;
g_debug ("****** IsInstalled");
@@ -293,9 +293,9 @@ notify_search_resources (GsShellExtrasMode mode,
const gchar *app_name = NULL;
const gchar *mode_string;
const gchar *title = NULL;
- _cleanup_free_ gchar *body = NULL;
- _cleanup_object_unref_ GDesktopAppInfo *app_info = NULL;
- _cleanup_object_unref_ GNotification *n = NULL;
+ g_autofree gchar *body = NULL;
+ g_autoptr(GDesktopAppInfo) app_info = NULL;
+ g_autoptr(GNotification) n = NULL;
if (desktop_id != NULL) {
app_info = g_desktop_app_info_new (desktop_id);
@@ -680,9 +680,9 @@ bus_gotten_cb (GObject *source_object,
gpointer user_data)
{
GsDbusHelper *dbus_helper = GS_DBUS_HELPER (user_data);
- _cleanup_object_unref_ GDBusConnection *connection = NULL;
- _cleanup_object_unref_ GDesktopAppInfo *app_info = NULL;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GDBusConnection) connection = NULL;
+ g_autoptr(GDesktopAppInfo) app_info = NULL;
+ g_autoptr(GError) error = NULL;
connection = g_bus_get_finish (res, &error);
if (connection == NULL) {
diff --git a/src/gs-feature-tile.c b/src/gs-feature-tile.c
index cc11d95..9d84f92 100644
--- a/src/gs-feature-tile.c
+++ b/src/gs-feature-tile.c
@@ -54,7 +54,7 @@ app_state_changed_idle (gpointer user_data)
{
GsFeatureTile *tile = GS_FEATURE_TILE (user_data);
AtkObject *accessible;
- _cleanup_free_ gchar *name = NULL;
+ g_autofree gchar *name = NULL;
accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
@@ -121,7 +121,7 @@ gs_feature_tile_set_app (GsFeatureTile *tile, GsApp *app)
/* check the app has the featured data */
text_color = gs_app_get_metadata_item (app, "Featured::text-color");
if (text_color == NULL) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
tmp = gs_app_to_string (app);
g_warning ("%s has no featured data: %s",
gs_app_get_id (app), tmp);
diff --git a/src/gs-folders.c b/src/gs-folders.c
index 8810287..f7b4a12 100644
--- a/src/gs-folders.c
+++ b/src/gs-folders.c
@@ -124,8 +124,8 @@ static gchar *
lookup_folder_name (const gchar *id)
{
gchar *name = NULL;
- _cleanup_free_ gchar *file = NULL;
- _cleanup_keyfile_unref_ GKeyFile *key_file = NULL;
+ g_autofree gchar *file = NULL;
+ g_autoptr(GKeyFile) key_file = NULL;
file = g_build_filename ("desktop-directories", id, NULL);
key_file = g_key_file_new ();
@@ -176,7 +176,7 @@ load (GsFolders *folders)
GHashTableIter iter;
gchar *app;
gchar *category;
- _cleanup_strv_free_ gchar **ids = NULL;
+ g_auto(GStrv) ids = NULL;
folders->folders = g_hash_table_new_full (g_str_hash, g_str_equal, NULL,
(GDestroyNotify)gs_folder_free);
folders->apps = g_hash_table_new (g_str_hash, g_str_equal);
@@ -185,12 +185,12 @@ load (GsFolders *folders)
ids = g_settings_get_strv (folders->settings, "folder-children");
g_object_get (folders->settings, "path", &path, NULL);
for (i = 0; ids[i]; i++) {
- _cleanup_free_ gchar **apps = NULL;
- _cleanup_free_ gchar **categories = NULL;
- _cleanup_free_ gchar *child_path = NULL;
- _cleanup_free_ gchar **excluded_apps = NULL;
- _cleanup_free_ gchar *name = NULL;
- _cleanup_object_unref_ GSettings *settings = NULL;
+ g_autofree gchar **apps = NULL;
+ g_autofree gchar **categories = NULL;
+ g_autofree gchar *child_path = NULL;
+ g_autofree gchar **excluded_apps = NULL;
+ g_autofree gchar *name = NULL;
+ g_autoptr(GSettings) settings = NULL;
child_path = g_strconcat (path, "folders/", ids[i], "/", NULL);
settings = g_settings_new_with_path (APP_FOLDER_CHILD_SCHEMA, child_path);
@@ -233,14 +233,14 @@ save (GsFolders *folders)
GHashTableIter iter;
GsFolder *folder;
gpointer keys;
- _cleanup_free_ gchar *path = NULL;
- _cleanup_free_ gpointer apps = NULL;
+ g_autofree gchar *path = NULL;
+ g_autofree gpointer apps = NULL;
g_object_get (folders->settings, "path", &path, NULL);
g_hash_table_iter_init (&iter, folders->folders);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&folder)) {
- _cleanup_free_ gchar *child_path = NULL;
- _cleanup_object_unref_ GSettings *settings = NULL;
+ g_autofree gchar *child_path = NULL;
+ g_autoptr(GSettings) settings = NULL;
child_path = g_strconcat (path, "folders/", folder->id, "/", NULL);
settings = g_settings_new_with_path (APP_FOLDER_CHILD_SCHEMA, child_path);
@@ -339,7 +339,7 @@ gs_folders_get_nonempty_folders (GsFolders *folders)
{
GHashTableIter iter;
GsFolder *folder;
- _cleanup_hashtable_unref_ GHashTable *tmp = NULL;
+ g_autoptr(GHashTable) tmp = NULL;
tmp = g_hash_table_new (g_str_hash, g_str_equal);
@@ -376,7 +376,7 @@ const gchar *
gs_folders_add_folder (GsFolders *folders, const gchar *id)
{
GsFolder *folder;
- _cleanup_free_ gchar *key = NULL;
+ g_autofree gchar *key = NULL;
key = g_strdup (id);
canonicalize_key (key);
@@ -538,8 +538,8 @@ gs_folders_revert (GsFolders *folders)
void
gs_folders_convert (void)
{
- _cleanup_object_unref_ GSettings *settings = NULL;
- _cleanup_strv_free_ gchar **ids = NULL;
+ g_autoptr(GSettings) settings = NULL;
+ g_auto(GStrv) ids = NULL;
settings = g_settings_new (APP_FOLDER_SCHEMA);
ids = g_settings_get_strv (settings, "folder-children");
diff --git a/src/gs-history-dialog.c b/src/gs-history-dialog.c
index 848932f..af13e29 100644
--- a/src/gs-history-dialog.c
+++ b/src/gs-history-dialog.c
@@ -70,8 +70,8 @@ gs_history_dialog_set_app (GsHistoryDialog *dialog, GsApp *app)
history = gs_app_get_history (app);
g_ptr_array_sort (history, history_sort_cb);
for (i = 0; i < history->len; i++) {
- _cleanup_date_time_unref_ GDateTime *datetime = NULL;
- _cleanup_free_ gchar *date_str = NULL;
+ g_autoptr(GDateTime) datetime = NULL;
+ g_autofree gchar *date_str = NULL;
app = g_ptr_array_index (history, i);
box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
diff --git a/src/gs-main.c b/src/gs-main.c
index 6f75dfc..08549ac 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -35,8 +35,8 @@ int
main (int argc, char **argv)
{
int status = 0;
- _cleanup_object_unref_ GsApplication *application = NULL;
- _cleanup_object_unref_ GsProfile *profile = NULL;
+ g_autoptr(GsApplication) application = NULL;
+ g_autoptr(GsProfile) profile = NULL;
setlocale (LC_ALL, "");
diff --git a/src/gs-markdown.c b/src/gs-markdown.c
index 079828e..0f6b4b1 100644
--- a/src/gs-markdown.c
+++ b/src/gs-markdown.c
@@ -105,7 +105,7 @@ gs_markdown_to_text_line_is_rule (const gchar *line)
guint i;
guint len;
guint count = 0;
- _cleanup_free_ gchar *copy = NULL;
+ g_autofree gchar *copy = NULL;
len = strlen (line);
if (len == 0)
@@ -230,7 +230,7 @@ gs_markdown_replace (const gchar *haystack,
const gchar *needle,
const gchar *replace)
{
- _cleanup_strv_free_ gchar **split = NULL;
+ g_auto(GStrv) split = NULL;
split = g_strsplit (haystack, needle, -1);
return g_strjoinv (replace, split);
}
@@ -277,7 +277,7 @@ gs_markdown_to_text_line_formatter (const gchar *line,
gchar *start = NULL;
gchar *middle = NULL;
gchar *end = NULL;
- _cleanup_free_ gchar *copy = NULL;
+ g_autofree gchar *copy = NULL;
/* needed to know for shifts */
len = strlen (formatter);
@@ -300,7 +300,7 @@ gs_markdown_to_text_line_formatter (const gchar *line,
/* if we found, replace and keep looking for the same string */
if (start != NULL && middle != NULL && end != NULL) {
- _cleanup_free_ gchar *temp = NULL;
+ g_autofree gchar *temp = NULL;
temp = g_strdup_printf ("%s%s%s%s%s", start, left, middle, right, end);
/* recursive */
return gs_markdown_to_text_line_formatter (temp, formatter, left, right);
@@ -376,7 +376,7 @@ gs_markdown_to_text_line_format (GsMarkdown *self, const gchar *line)
gboolean mode = FALSE;
gchar *text;
guint i;
- _cleanup_strv_free_ gchar **codes = NULL;
+ g_auto(GStrv) codes = NULL;
/* optimise the trivial case where we don't have any code tags */
text = strstr (line, "`");
@@ -409,7 +409,7 @@ gs_markdown_to_text_line_format (GsMarkdown *self, const gchar *line)
static gboolean
gs_markdown_add_pending (GsMarkdown *self, const gchar *line)
{
- _cleanup_free_ gchar *copy = NULL;
+ g_autofree gchar *copy = NULL;
/* would put us over the limit */
if (self->max_lines > 0 && self->line_count >= self->max_lines)
@@ -431,7 +431,7 @@ gs_markdown_add_pending (GsMarkdown *self, const gchar *line)
static gboolean
gs_markdown_add_pending_header (GsMarkdown *self, const gchar *line)
{
- _cleanup_free_ gchar *copy = NULL;
+ g_autofree gchar *copy = NULL;
/* strip trailing # */
copy = g_strdup (line);
@@ -514,7 +514,7 @@ gs_markdown_word_auto_format_code (const gchar *text)
guint i;
gchar *temp;
gboolean ret = FALSE;
- _cleanup_strv_free_ gchar **words = NULL;
+ g_auto(GStrv) words = NULL;
/* split sentence up with space */
words = g_strsplit (text, " ", -1);
@@ -561,7 +561,7 @@ gs_markdown_word_auto_format_urls (const gchar *text)
guint i;
gchar *temp;
gboolean ret = FALSE;
- _cleanup_strv_free_ gchar **words = NULL;
+ g_auto(GStrv) words = NULL;
/* split sentence up with space */
words = g_strsplit (text, " ", -1);
@@ -591,8 +591,8 @@ gs_markdown_word_auto_format_urls (const gchar *text)
static void
gs_markdown_flush_pending (GsMarkdown *self)
{
- _cleanup_free_ gchar *copy = NULL;
- _cleanup_free_ gchar *temp = NULL;
+ g_autofree gchar *copy = NULL;
+ g_autofree gchar *temp = NULL;
/* no data yet */
if (self->mode == GS_MARKDOWN_MODE_UNKNOWN)
@@ -891,7 +891,7 @@ gs_markdown_parse (GsMarkdown *self, const gchar *markdown)
gchar *temp;
guint i;
guint len;
- _cleanup_strv_free_ gchar **lines = NULL;
+ g_auto(GStrv) lines = NULL;
g_return_val_if_fail (GS_IS_MARKDOWN (self), NULL);
diff --git a/src/gs-page.c b/src/gs-page.c
index bb88349..602ce5d 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -65,7 +65,7 @@ gs_page_app_installed_cb (GObject *source,
GsPage *page = data->page;
GsPagePrivate *priv = gs_page_get_instance_private (page);
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
ret = gs_plugin_loader_app_action_finish (plugin_loader,
res,
@@ -103,7 +103,7 @@ gs_page_app_removed_cb (GObject *source,
GsPage *page = data->page;
GsPagePrivate *priv = gs_page_get_instance_private (page);
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
ret = gs_plugin_loader_app_action_finish (plugin_loader,
res,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index d2b9763..62dc13e 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -192,7 +192,7 @@ gs_plugin_loader_run_refine_plugin (GsPluginLoader *plugin_loader,
const gchar *function_name = "gs_plugin_refine";
gboolean exists;
gboolean ret = TRUE;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* load the symbol */
exists = g_module_symbol (plugin->module,
@@ -367,7 +367,7 @@ gs_plugin_loader_run_results_plugin (GsPluginLoader *plugin_loader,
GsPluginResultsFunc plugin_func = NULL;
gboolean exists;
gboolean ret = TRUE;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* get symbol */
exists = g_module_symbol (plugin->module,
@@ -407,7 +407,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
GList *list = NULL;
GsPlugin *plugin;
guint i;
- _cleanup_free_ gchar *profile_id_parent = NULL;
+ g_autofree gchar *profile_id_parent = NULL;
g_return_val_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader), NULL);
g_return_val_if_fail (function_name != NULL, NULL);
@@ -677,7 +677,7 @@ gs_plugin_loader_run_action_plugin (GsPluginLoader *plugin_loader,
GsPluginActionFunc plugin_func = NULL;
gboolean exists;
gboolean ret = TRUE;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
exists = g_module_symbol (plugin->module,
function_name,
@@ -783,8 +783,8 @@ gs_plugin_loader_add_os_update_item (GList *list)
GList *l;
GsApp *app_os;
GsApp *app_tmp;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
/* do we have any packages left that are not apps? */
for (l = list; l != NULL; l = l->next) {
@@ -906,7 +906,7 @@ gs_plugin_loader_get_updates_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1001,7 +1001,7 @@ gs_plugin_loader_get_sources_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1103,7 +1103,7 @@ gs_plugin_loader_get_installed_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1190,7 +1190,7 @@ gs_plugin_loader_get_popular_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1310,7 +1310,7 @@ gs_plugin_loader_get_featured_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1427,8 +1427,8 @@ gs_plugin_loader_search_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginSearchFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
- _cleanup_strv_free_ gchar **values = NULL;
+ g_autofree gchar *profile_id = NULL;
+ g_auto(GStrv) values = NULL;
/* run each plugin */
values = as_utils_search_tokenize (state->value);
@@ -1545,7 +1545,7 @@ gs_plugin_loader_search_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1600,8 +1600,8 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginSearchFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
- _cleanup_strv_free_ gchar **values = NULL;
+ g_autofree gchar *profile_id = NULL;
+ g_auto(GStrv) values = NULL;
values = g_new0 (gchar *, 2);
values[0] = g_strdup (state->value);
@@ -1714,7 +1714,7 @@ gs_plugin_loader_search_files_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1769,8 +1769,8 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginSearchFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
- _cleanup_strv_free_ gchar **values = NULL;
+ g_autofree gchar *profile_id = NULL;
+ g_auto(GStrv) values = NULL;
values = g_new0 (gchar *, 2);
values[0] = g_strdup (state->value);
@@ -1883,7 +1883,7 @@ gs_plugin_loader_search_what_provides_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -1949,7 +1949,7 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
GsPluginResultsFunc plugin_func = NULL;
GList *l;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
@@ -2012,7 +2012,7 @@ gs_plugin_loader_get_categories_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -2066,7 +2066,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginCategoryFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
@@ -2168,7 +2168,7 @@ gs_plugin_loader_get_category_apps_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -2253,7 +2253,7 @@ gs_plugin_loader_app_refine_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (GS_IS_APP (app));
@@ -2316,7 +2316,7 @@ gs_plugin_loader_app_action_thread_cb (GTask *task,
GPtrArray *addons;
gboolean ret;
guint i;
- _cleanup_list_free_ GList *list = NULL;
+ g_autoptr(GList) list = NULL;
/* add to list */
g_mutex_lock (&priv->pending_apps_mutex);
@@ -2385,9 +2385,9 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
GList *list = NULL;
gboolean ret = TRUE;
guint i;
- _cleanup_free_ gchar *contents = NULL;
- _cleanup_free_ gchar *file = NULL;
- _cleanup_strv_free_ gchar **names = NULL;
+ g_autofree gchar *contents = NULL;
+ g_autofree gchar *file = NULL;
+ g_auto(GStrv) names = NULL;
/* load from file */
file = g_build_filename (g_get_user_data_dir (),
@@ -2404,7 +2404,7 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
/* add each app-id */
names = g_strsplit (contents, "\n", 0);
for (i = 0; names[i]; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
if (strlen (names[i]) == 0)
continue;
app = gs_app_new (names[i]);
@@ -2448,9 +2448,9 @@ save_install_queue (GsPluginLoader *plugin_loader)
GPtrArray *pending_apps;
gboolean ret;
gint i;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_string_free_ GString *s = NULL;
- _cleanup_free_ gchar *file = NULL;
+ g_autofree gchar *file = NULL;
s = g_string_new ("");
pending_apps = priv->pending_apps;
@@ -2549,7 +2549,7 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (GS_IS_APP (app));
@@ -2683,7 +2683,7 @@ gs_plugin_loader_run (GsPluginLoader *plugin_loader, const gchar *function_name)
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
plugin = g_ptr_array_index (priv->plugins, i);
ret = g_module_symbol (plugin->module,
function_name,
@@ -2889,7 +2889,7 @@ void
gs_plugin_loader_set_location (GsPluginLoader *plugin_loader, const gchar *location)
{
GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
- _cleanup_free_ gchar *filename = NULL;
+ g_autofree gchar *filename = NULL;
g_free (priv->location);
@@ -2954,7 +2954,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
guint dep_loop_check = 0;
guint i;
guint j;
- _cleanup_dir_close_ GDir *dir = NULL;
+ g_autoptr(GDir) dir = NULL;
g_return_val_if_fail (priv->location != NULL, FALSE);
@@ -2969,7 +2969,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader, GError **error)
/* try to open each plugin */
g_debug ("searching for plugins in %s", priv->location);
do {
- _cleanup_free_ gchar *filename_plugin = NULL;
+ g_autofree gchar *filename_plugin = NULL;
filename_tmp = g_dir_read_name (dir);
if (filename_tmp == NULL)
break;
@@ -3215,8 +3215,8 @@ gs_plugin_loader_app_installed_cb (GObject *source,
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_object_unref_ GsApp *app = GS_APP (user_data);
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GsApp) app = GS_APP (user_data);
ret = gs_plugin_loader_app_action_finish (plugin_loader,
res,
@@ -3289,7 +3289,7 @@ gs_plugin_loader_run_refresh_plugin (GsPluginLoader *plugin_loader,
gboolean ret = TRUE;
GError *error_local = NULL;
GsPluginRefreshFunc plugin_func = NULL;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
exists = g_module_symbol (plugin->module,
function_name,
@@ -3410,7 +3410,7 @@ gs_plugin_loader_refresh_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -3465,7 +3465,7 @@ gs_plugin_loader_filename_to_app_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginFilenameToAppFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
@@ -3554,7 +3554,7 @@ gs_plugin_loader_filename_to_app_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -3609,7 +3609,7 @@ gs_plugin_loader_offline_update_thread_cb (GTask *task,
GsPlugin *plugin;
GsPluginOfflineUpdateFunc plugin_func = NULL;
guint i;
- _cleanup_free_ gchar *profile_id = NULL;
+ g_autofree gchar *profile_id = NULL;
/* run each plugin */
for (i = 0; i < priv->plugins->len; i++) {
@@ -3657,7 +3657,7 @@ gs_plugin_loader_offline_update_async (GsPluginLoader *plugin_loader,
gpointer user_data)
{
GsPluginLoaderAsyncState *state;
- _cleanup_object_unref_ GTask *task = NULL;
+ g_autoptr(GTask) task = NULL;
g_return_if_fail (GS_IS_PLUGIN_LOADER (plugin_loader));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index 3361de9..2556b9b 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -66,9 +66,9 @@ gs_plugin_set_enabled (GsPlugin *plugin, gboolean enabled)
gboolean
gs_plugin_check_distro_id (GsPlugin *plugin, const gchar *distro_id)
{
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_free_ gchar *data = NULL;
- _cleanup_free_ gchar *search = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *data = NULL;
+ g_autofree gchar *search = NULL;
/* check that we are running on Fedora */
if (!g_file_get_contents (GS_PLUGIN_OS_RELEASE_FN, &data, NULL, &error)) {
@@ -138,7 +138,7 @@ gs_plugin_list_randomize_cb (gconstpointer a, gconstpointer b, gpointer user_dat
{
const gchar *k1;
const gchar *k2;
- _cleanup_free_ gchar *key = NULL;
+ g_autofree gchar *key = NULL;
key = g_strdup_printf ("Plugin::sort-key[%p]", user_data);
k1 = gs_app_get_metadata_item (GS_APP (a), key);
@@ -158,8 +158,8 @@ gs_plugin_list_randomize (GList **list)
GRand *rand;
GsApp *app;
gchar sort_key[] = { '\0', '\0', '\0', '\0' };
- _cleanup_date_time_unref_ GDateTime *date = NULL;
- _cleanup_free_ gchar *key = NULL;
+ g_autoptr(GDateTime) date = NULL;
+ g_autofree gchar *key = NULL;
g_return_if_fail (list != NULL);
@@ -193,7 +193,7 @@ gs_plugin_list_filter_duplicates (GList **list)
GsApp *app;
GsApp *found;
const gchar *id;
- _cleanup_hashtable_unref_ GHashTable *hash = NULL;
+ g_autoptr(GHashTable) hash = NULL;
g_return_if_fail (list != NULL);
diff --git a/src/gs-popular-tile.c b/src/gs-popular-tile.c
index 1565788..e2a10b6 100644
--- a/src/gs-popular-tile.c
+++ b/src/gs-popular-tile.c
@@ -58,7 +58,7 @@ app_state_changed_idle (gpointer user_data)
AtkObject *accessible;
GtkWidget *label;
gboolean installed;
- _cleanup_free_ gchar *name = NULL;
+ g_autofree gchar *name = NULL;
accessible = gtk_widget_get_accessible (GTK_WIDGET (tile));
diff --git a/src/gs-profile.c b/src/gs-profile.c
index bf07d7f..9516687 100644
--- a/src/gs-profile.c
+++ b/src/gs-profile.c
@@ -83,7 +83,7 @@ gs_profile_start (GsProfile *profile, const gchar *id)
{
GThread *self;
GsProfileItem *item;
- _cleanup_free_ gchar *id_thr = NULL;
+ g_autofree gchar *id_thr = NULL;
g_return_if_fail (GS_IS_PROFILE (profile));
g_return_if_fail (id != NULL);
@@ -127,7 +127,7 @@ gs_profile_stop (GsProfile *profile, const gchar *id)
GThread *self;
GsProfileItem *item;
gdouble elapsed_ms;
- _cleanup_free_ gchar *id_thr = NULL;
+ g_autofree gchar *id_thr = NULL;
g_return_if_fail (GS_IS_PROFILE (profile));
g_return_if_fail (id != NULL);
diff --git a/src/gs-proxy-settings.c b/src/gs-proxy-settings.c
index ea031a2..e0815bd 100644
--- a/src/gs-proxy-settings.c
+++ b/src/gs-proxy-settings.c
@@ -48,9 +48,9 @@ get_proxy_http (GsProxySettings *proxy_settings)
GString *string = NULL;
guint port;
GDesktopProxyMode proxy_mode;
- _cleanup_free_ gchar *host = NULL;
- _cleanup_free_ gchar *password = NULL;
- _cleanup_free_ gchar *username = NULL;
+ g_autofree gchar *host = NULL;
+ g_autofree gchar *password = NULL;
+ g_autofree gchar *username = NULL;
proxy_mode = g_settings_get_enum (proxy_settings->settings, "mode");
if (proxy_mode != G_DESKTOP_PROXY_MODE_MANUAL)
@@ -90,7 +90,7 @@ get_proxy_ftp (GsProxySettings *proxy_settings)
GString *string = NULL;
guint port;
GDesktopProxyMode proxy_mode;
- _cleanup_free_ gchar *host = NULL;
+ g_autofree gchar *host = NULL;
proxy_mode = g_settings_get_enum (proxy_settings->settings, "mode");
if (proxy_mode != G_DESKTOP_PROXY_MODE_MANUAL)
@@ -113,7 +113,7 @@ get_proxy_ftp (GsProxySettings *proxy_settings)
static void
set_proxy_cb (GObject *object, GAsyncResult *res, gpointer user_data)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!pk_control_set_proxy_finish (PK_CONTROL (object), res, &error)) {
if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
g_warning ("failed to set proxies: %s", error->message);
@@ -123,8 +123,8 @@ set_proxy_cb (GObject *object, GAsyncResult *res, gpointer user_data)
static void
reload_proxy_settings (GsProxySettings *proxy_settings)
{
- _cleanup_free_ gchar *proxy_http = NULL;
- _cleanup_free_ gchar *proxy_ftp = NULL;
+ g_autofree gchar *proxy_http = NULL;
+ g_autofree gchar *proxy_ftp = NULL;
proxy_http = get_proxy_http (proxy_settings);
proxy_ftp = get_proxy_ftp (proxy_settings);
diff --git a/src/gs-screenshot-image.c b/src/gs-screenshot-image.c
index 7bbb4a4..6defab7 100644
--- a/src/gs-screenshot-image.c
+++ b/src/gs-screenshot-image.c
@@ -91,7 +91,7 @@ gs_screenshot_image_get_desktop_pixbuf (GsScreenshotImage *ssimg)
{
_cleanup_object_unref_ GnomeBG *bg = NULL;
_cleanup_object_unref_ GnomeDesktopThumbnailFactory *factory = NULL;
- _cleanup_object_unref_ GSettings *settings = NULL;
+ g_autoptr(GSettings) settings = NULL;
factory = gnome_desktop_thumbnail_factory_new (GNOME_DESKTOP_THUMBNAIL_SIZE_LARGE);
bg = gnome_bg_new ();
@@ -129,8 +129,8 @@ gs_screenshot_image_use_desktop_background (GsScreenshotImage *ssimg, GdkPixbuf
static void
as_screenshot_show_image (GsScreenshotImage *ssimg)
{
- _cleanup_object_unref_ GdkPixbuf *pixbuf_bg = NULL;
- _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
+ g_autoptr(GdkPixbuf) pixbuf_bg = NULL;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
/* no need to composite */
if (ssimg->width == G_MAXUINT || ssimg->height == G_MAXUINT) {
@@ -187,7 +187,7 @@ gs_screenshot_image_show_blurred (GsScreenshotImage *ssimg,
const gchar *filename_thumb)
{
_cleanup_object_unref_ AsImage *im = NULL;
- _cleanup_object_unref_ GdkPixbuf *pb = NULL;
+ g_autoptr(GdkPixbuf) pb = NULL;
/* create an helper which can do the blurring for us */
im = as_image_new ();
@@ -217,12 +217,12 @@ gs_screenshot_image_complete_cb (SoupSession *session,
SoupMessage *msg,
gpointer user_data)
{
- _cleanup_object_unref_ GsScreenshotImage *ssimg = GS_SCREENSHOT_IMAGE (user_data);
+ g_autoptr(GsScreenshotImage) ssimg = GS_SCREENSHOT_IMAGE (user_data);
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_object_unref_ AsImage *im = NULL;
- _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
- _cleanup_object_unref_ GInputStream *stream = NULL;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
+ g_autoptr(GInputStream) stream = NULL;
/* return immediately if the message was cancelled or if we're in destruction */
if (msg->status_code == SOUP_STATUS_CANCELLED || ssimg->session == NULL)
@@ -347,10 +347,10 @@ gs_screenshot_image_load_async (GsScreenshotImage *ssimg,
SoupURI *base_uri = NULL;
const gchar *url;
gint rc;
- _cleanup_free_ gchar *basename = NULL;
- _cleanup_free_ gchar *cachedir2 = NULL;
- _cleanup_free_ gchar *cachedir = NULL;
- _cleanup_free_ gchar *sizedir = NULL;
+ g_autofree gchar *basename = NULL;
+ g_autofree gchar *cachedir2 = NULL;
+ g_autofree gchar *cachedir = NULL;
+ g_autofree gchar *sizedir = NULL;
g_return_if_fail (GS_IS_SCREENSHOT_IMAGE (ssimg));
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index b92211a..e7a1aaa 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -40,7 +40,7 @@ gs_markdown_func (void)
gchar *text;
const gchar *markdown;
const gchar *markdown_expected;
- _cleanup_object_unref_ GsMarkdown *md = NULL;
+ g_autoptr(GsMarkdown) md = NULL;
/* get GsMarkdown object */
md = gs_markdown_new (GS_MARKDOWN_OUTPUT_PANGO);
@@ -276,8 +276,8 @@ gs_plugin_func (void)
static void
gs_app_subsume_func (void)
{
- _cleanup_object_unref_ GsApp *new = NULL;
- _cleanup_object_unref_ GsApp *old = NULL;
+ g_autoptr(GsApp) new = NULL;
+ g_autoptr(GsApp) old = NULL;
new = gs_app_new ("xxx.desktop");
old = gs_app_new ("yyy.desktop");
@@ -289,7 +289,7 @@ gs_app_subsume_func (void)
static void
gs_app_func (void)
{
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new ("gnome-software");
g_assert (GS_IS_APP (app));
@@ -328,9 +328,9 @@ gs_plugin_loader_status_changed_cb (GsPluginLoader *plugin_loader,
static void
gs_plugin_loader_dedupe_func (void)
{
- _cleanup_object_unref_ GsApp *app1 = NULL;
- _cleanup_object_unref_ GsApp *app2 = NULL;
- _cleanup_object_unref_ GsPluginLoader *loader = NULL;
+ g_autoptr(GsApp) app1 = NULL;
+ g_autoptr(GsApp) app2 = NULL;
+ g_autoptr(GsPluginLoader) loader = NULL;
loader = gs_plugin_loader_new ();
@@ -358,7 +358,7 @@ gs_plugin_loader_func (void)
GList *list;
GList *l;
GsApp *app;
- _cleanup_object_unref_ GsPluginLoader *loader = NULL;
+ g_autoptr(GsPluginLoader) loader = NULL;
/* not avaiable in make distcheck */
if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
@@ -498,8 +498,8 @@ gs_plugin_loader_refine_func (void)
GError *error = NULL;
const gchar *url;
gboolean ret;
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_object_unref_ GsPluginLoader *loader = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_autoptr(GsPluginLoader) loader = NULL;
/* not avaiable in make distcheck */
if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
@@ -548,7 +548,7 @@ gs_plugin_loader_empty_func (void)
GsCategory *category;
GsCategory *sub;
guint empty_subcats_cnt = 0;
- _cleanup_object_unref_ GsPluginLoader *loader = NULL;
+ g_autoptr(GsPluginLoader) loader = NULL;
/* not avaiable in make distcheck */
if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
@@ -630,9 +630,9 @@ gs_plugin_loader_webapps_func (void)
{
gboolean ret;
GError *error = NULL;
- _cleanup_free_ gchar *path = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_object_unref_ GsPluginLoader *loader = NULL;
+ g_autofree gchar *path = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_autoptr(GsPluginLoader) loader = NULL;
/* not avaiable in make distcheck */
if (!g_file_test (GS_MODULESETDIR, G_FILE_TEST_EXISTS))
diff --git a/src/gs-shell-category.c b/src/gs-shell-category.c
index 37ab280..e735ad7 100644
--- a/src/gs-shell-category.c
+++ b/src/gs-shell-category.c
@@ -93,7 +93,7 @@ gs_shell_category_get_apps_cb (GObject *source_object,
GtkWidget *tile;
GsShellCategory *self = GS_SHELL_CATEGORY (user_data);
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_get_category_apps_finish (plugin_loader,
res,
@@ -182,7 +182,7 @@ gs_shell_category_create_filter_list (GsShellCategory *self,
GtkWidget *row;
GList *l;
GsCategory *s;
- _cleanup_list_free_ GList *list = NULL;
+ g_autoptr(GList) list = NULL;
gs_container_remove_all (GTK_CONTAINER (self->category_detail_grid));
@@ -215,7 +215,7 @@ gs_shell_category_set_category (GsShellCategory *self, GsCategory *category)
GsCategory *sub;
GsCategory *selected = NULL;
GList *l;
- _cleanup_list_free_ GList *list = NULL;
+ g_autoptr(GList) list = NULL;
/* this means we've come from the app-view -> back */
if (self->category == category)
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 0043ab2..193b65d 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -342,7 +342,7 @@ gs_shell_details_screenshot_selected_cb (GtkListBox *list,
GsScreenshotImage *ssmain;
GsScreenshotImage *ssthumb;
AsScreenshot *ss;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
if (row == NULL)
return;
@@ -483,7 +483,7 @@ gs_shell_details_set_description (GsShellDetails *self, const gchar *tmp)
GtkStyleContext *style_context;
GtkWidget *para;
guint i;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_auto(GStrv) split = NULL;
/* does the description exist? */
gtk_widget_set_visible (self->box_details_description, tmp != NULL);
@@ -526,7 +526,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
GtkWidget *widget;
const gchar *tmp;
guint64 updated;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* change widgets */
tmp = gs_app_get_name (self->app);
@@ -620,7 +620,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
/* TRANSLATORS: this is where the size is not known */
gtk_label_set_label (GTK_LABEL (self->label_details_size_value), C_("size", "Unknown"));
} else {
- _cleanup_free_ gchar *size = NULL;
+ g_autofree gchar *size = NULL;
size = g_format_size (gs_app_get_size (self->app));
gtk_label_set_label (GTK_LABEL (self->label_details_size_value), size);
}
@@ -632,8 +632,8 @@ gs_shell_details_refresh_all (GsShellDetails *self)
/* TRANSLATORS: this is where the updated date is not known */
gtk_label_set_label (GTK_LABEL (self->label_details_updated_value), C_("updated", "Never"));
} else {
- _cleanup_date_time_unref_ GDateTime *dt = NULL;
- _cleanup_free_ gchar *updated_str = NULL;
+ g_autoptr(GDateTime) dt = NULL;
+ g_autofree gchar *updated_str = NULL;
dt = g_date_time_new_from_unix_utc (updated);
updated_str = g_date_time_format (dt, "%x");
gtk_label_set_label (GTK_LABEL (self->label_details_updated_value), updated_str);
@@ -870,8 +870,8 @@ gs_shell_details_app_refine_cb (GObject *source,
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
GsShellDetails *self = GS_SHELL_DETAILS (user_data);
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_free_ gchar *app_dump = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *app_dump = NULL;
ret = gs_plugin_loader_app_refine_finish (plugin_loader,
res,
@@ -903,8 +903,8 @@ gs_shell_details_filename_to_app_cb (GObject *source,
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
GsShellDetails *self = GS_SHELL_DETAILS (user_data);
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_free_ gchar *tmp = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *tmp = NULL;
if (self->app != NULL)
g_object_unref (self->app);
@@ -1057,7 +1057,7 @@ static void
gs_shell_details_app_install_button_cb (GtkWidget *widget, GsShellDetails *self)
{
GList *l;
- _cleanup_list_free_ GList *addons = NULL;
+ g_autoptr(GList) addons = NULL;
/* Mark ticked addons to be installed together with the app */
addons = gtk_container_get_children (GTK_CONTAINER (self->list_box_addons));
@@ -1114,9 +1114,9 @@ gs_shell_details_app_launch_button_cb (GtkWidget *widget, GsShellDetails *self)
{
GdkDisplay *display;
const gchar *desktop_id;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_object_unref_ GAppInfo *appinfo = NULL;
- _cleanup_object_unref_ GAppLaunchContext *context = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GAppInfo) appinfo = NULL;
+ g_autoptr(GAppLaunchContext) context = NULL;
desktop_id = gs_app_get_id (self->app);
if (desktop_id == NULL) {
@@ -1159,7 +1159,7 @@ gs_shell_details_app_set_ratings_cb (GObject *source,
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
GsShellDetails *self = GS_SHELL_DETAILS (user_data);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
g_warning ("failed to set rating %s: %s",
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 0659227..71167fc 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -156,8 +156,8 @@ static gchar *
build_title (GsShellExtras *self)
{
guint i;
- _cleanup_free_ gchar *titles = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *title_array = NULL;
+ g_autofree gchar *titles = NULL;
+ g_autoptr(GPtrArray) title_array = NULL;
title_array = g_ptr_array_new ();
for (i = 0; i < self->array_search_data->len; i++) {
@@ -194,7 +194,7 @@ static void
gs_shell_extras_update_ui_state (GsShellExtras *self)
{
GtkWidget *widget;
- _cleanup_free_ gchar *title = NULL;
+ g_autofree gchar *title = NULL;
if (gs_shell_get_mode (self->shell) != GS_SHELL_MODE_EXTRAS)
return;
@@ -279,7 +279,7 @@ gs_shell_extras_add_app (GsShellExtras *self, GsApp *app, SearchData *search_dat
{
GtkWidget *app_row;
GList *l;
- _cleanup_list_free_ GList *list = NULL;
+ g_autoptr(GList) list = NULL;
/* Don't add same app twice */
list = gtk_container_get_children (GTK_CONTAINER (self->list_box_results));
@@ -315,8 +315,8 @@ create_missing_app (SearchData *search_data)
GsShellExtras *self = search_data->self;
GsApp *app;
GString *summary_missing;
- _cleanup_free_ gchar *name = NULL;
- _cleanup_free_ gchar *url = NULL;
+ g_autofree gchar *name = NULL;
+ g_autofree gchar *url = NULL;
app = gs_app_new ("missing-codec");
@@ -437,10 +437,10 @@ build_no_results_label (GsShellExtras *self)
GList *l;
GsApp *app = NULL;
guint num;
- _cleanup_free_ gchar *codec_titles = NULL;
- _cleanup_free_ gchar *url = NULL;
- _cleanup_list_free_ GList *list = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autofree gchar *codec_titles = NULL;
+ g_autofree gchar *url = NULL;
+ g_autoptr(GList) list = NULL;
+ g_autoptr(GPtrArray) array = NULL;
list = gtk_container_get_children (GTK_CONTAINER (self->list_box_results));
num = g_list_length (list);
@@ -476,7 +476,7 @@ show_search_results (GsShellExtras *self)
GList *l;
guint n_children;
guint n_missing;
- _cleanup_list_free_ GList *list = NULL;
+ g_autoptr(GList) list = NULL;
list = gtk_container_get_children (GTK_CONTAINER (self->list_box_results));
n_children = g_list_length (list);
@@ -491,7 +491,7 @@ show_search_results (GsShellExtras *self)
}
if (n_children == 0 || n_children == n_missing) {
- _cleanup_free_ gchar *str = NULL;
+ g_autofree gchar *str = NULL;
/* no results */
g_debug ("extras: failed to find any results, %d", n_missing);
@@ -522,7 +522,7 @@ search_files_cb (GObject *source_object,
_cleanup_plugin_list_free_ GList *list = NULL;
GList *l;
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_search_what_provides_finish (plugin_loader, res, &error);
if (list == NULL) {
@@ -539,7 +539,7 @@ search_files_cb (GObject *source_object,
app = create_missing_app (search_data);
list = g_list_prepend (list, app);
} else {
- _cleanup_free_ gchar *str = NULL;
+ g_autofree gchar *str = NULL;
g_warning ("failed to find any search results: %s", error->message);
str = g_strdup_printf ("%s: %s", _("Failed to find any search results"),
error->message);
@@ -573,7 +573,7 @@ filename_to_app_cb (GObject *source_object,
GsShellExtras *self = search_data->self;
GsApp *app;
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
app = gs_plugin_loader_filename_to_app_finish (plugin_loader, res, &error);
if (app == NULL) {
@@ -587,7 +587,7 @@ filename_to_app_cb (GObject *source_object,
g_debug ("extras: no search result for %s, showing as missing", search_data->title);
app = create_missing_app (search_data);
} else {
- _cleanup_free_ gchar *str = NULL;
+ g_autofree gchar *str = NULL;
g_warning ("failed to find any search results: %s", error->message);
str = g_strdup_printf ("%s: %s", _("Failed to find any search results"),
error->message);
@@ -620,7 +620,7 @@ get_search_what_provides_cb (GObject *source_object,
_cleanup_plugin_list_free_ GList *list = NULL;
GList *l;
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_search_what_provides_finish (plugin_loader, res, &error);
if (list == NULL) {
@@ -637,7 +637,7 @@ get_search_what_provides_cb (GObject *source_object,
app = create_missing_app (search_data);
list = g_list_prepend (list, app);
} else {
- _cleanup_free_ gchar *str = NULL;
+ g_autofree gchar *str = NULL;
g_warning ("failed to find any search results: %s", error->message);
str = g_strdup_printf ("%s: %s", _("Failed to find any search results"),
error->message);
@@ -745,7 +745,7 @@ gs_shell_extras_reload (GsShellExtras *self)
static void
gs_shell_extras_search_package_files (GsShellExtras *self, gchar **files)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; files[i] != NULL; i++) {
@@ -765,7 +765,7 @@ gs_shell_extras_search_package_files (GsShellExtras *self, gchar **files)
static void
gs_shell_extras_search_provide_files (GsShellExtras *self, gchar **files)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; files[i] != NULL; i++) {
@@ -785,7 +785,7 @@ gs_shell_extras_search_provide_files (GsShellExtras *self, gchar **files)
static void
gs_shell_extras_search_package_names (GsShellExtras *self, gchar **package_names)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; package_names[i] != NULL; i++) {
@@ -805,7 +805,7 @@ gs_shell_extras_search_package_names (GsShellExtras *self, gchar **package_names
static void
gs_shell_extras_search_mime_types (GsShellExtras *self, gchar **mime_types)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; mime_types[i] != NULL; i++) {
@@ -835,8 +835,8 @@ static gchar *
gs_shell_extras_font_tag_to_localised_name (GsShellExtras *self, const gchar *tag)
{
gchar *name;
- _cleanup_free_ gchar *lang = NULL;
- _cleanup_free_ gchar *language = NULL;
+ g_autofree gchar *lang = NULL;
+ g_autofree gchar *language = NULL;
/* use fontconfig to get the language code */
lang = font_tag_to_lang (tag);
@@ -863,7 +863,7 @@ gs_shell_extras_font_tag_to_localised_name (GsShellExtras *self, const gchar *ta
static void
gs_shell_extras_search_fontconfig_resources (GsShellExtras *self, gchar **resources)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; resources[i] != NULL; i++) {
@@ -883,12 +883,12 @@ gs_shell_extras_search_fontconfig_resources (GsShellExtras *self, gchar **resour
static void
gs_shell_extras_search_gstreamer_resources (GsShellExtras *self, gchar **resources)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; resources[i] != NULL; i++) {
SearchData *search_data;
- _cleanup_strv_free_ gchar **parts = NULL;
+ g_auto(GStrv) parts = NULL;
parts = g_strsplit (resources[i], "|", 2);
@@ -906,7 +906,7 @@ gs_shell_extras_search_gstreamer_resources (GsShellExtras *self, gchar **resourc
static void
gs_shell_extras_search_plasma_resources (GsShellExtras *self, gchar **resources)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i;
for (i = 0; resources[i] != NULL; i++) {
@@ -926,7 +926,7 @@ gs_shell_extras_search_plasma_resources (GsShellExtras *self, gchar **resources)
static void
gs_shell_extras_search_printer_drivers (GsShellExtras *self, gchar **device_ids)
{
- _cleanup_ptrarray_unref_ GPtrArray *array_search_data = g_ptr_array_new_with_free_func
((GDestroyNotify) search_data_free);
+ g_autoptr(GPtrArray) array_search_data = g_ptr_array_new_with_free_func ((GDestroyNotify)
search_data_free);
guint i, j;
guint len;
@@ -940,10 +940,10 @@ gs_shell_extras_search_printer_drivers (GsShellExtras *self, gchar **device_ids)
SearchData *search_data;
gchar *p;
guint n_fields;
- _cleanup_free_ gchar *tag = NULL;
- _cleanup_free_ gchar *mfg = NULL;
- _cleanup_free_ gchar *mdl = NULL;
- _cleanup_strv_free_ gchar **fields = NULL;
+ g_autofree gchar *tag = NULL;
+ g_autofree gchar *mfg = NULL;
+ g_autofree gchar *mdl = NULL;
+ g_auto(GStrv) fields = NULL;
fields = g_strsplit (device_ids[i], ";", 0);
n_fields = g_strv_length (fields);
@@ -1087,8 +1087,8 @@ list_sort_func (GtkListBoxRow *a,
{
GsApp *a1 = gs_app_row_get_app (GS_APP_ROW (a));
GsApp *a2 = gs_app_row_get_app (GS_APP_ROW (b));
- _cleanup_free_ gchar *key1 = get_app_sort_key (a1);
- _cleanup_free_ gchar *key2 = get_app_sort_key (a2);
+ g_autofree gchar *key1 = get_app_sort_key (a1);
+ g_autofree gchar *key2 = get_app_sort_key (a2);
/* compare the keys according to the algorithm above */
return g_strcmp0 (key1, key2);
@@ -1174,7 +1174,7 @@ gs_shell_extras_dispose (GObject *object)
static void
gs_shell_extras_init (GsShellExtras *self)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
gtk_widget_init_template (GTK_WIDGET (self));
diff --git a/src/gs-shell-installed.c b/src/gs-shell-installed.c
index c864965..e005d35 100644
--- a/src/gs-shell-installed.c
+++ b/src/gs-shell-installed.c
@@ -104,7 +104,7 @@ gs_shell_installed_app_removed (GsPage *page, GsApp *app)
{
GsShellInstalled *self = GS_SHELL_INSTALLED (page);
GList *l;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
children = gtk_container_get_children (GTK_CONTAINER (self->list_box_install));
for (l = children; l; l = l->next) {
@@ -193,7 +193,7 @@ gs_shell_installed_get_installed_cb (GObject *source_object,
GsApp *app;
GsShellInstalled *self = GS_SHELL_INSTALLED (user_data);
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
gs_stop_spinner (GTK_SPINNER (self->spinner_install));
gtk_stack_set_visible_child_name (GTK_STACK (self->stack_install), "view");
@@ -310,7 +310,7 @@ static gchar *
gs_shell_installed_get_app_sort_key (GsApp *app)
{
GString *key;
- _cleanup_free_ gchar *casefolded_name = NULL;
+ g_autofree gchar *casefolded_name = NULL;
key = g_string_sized_new (64);
@@ -368,8 +368,8 @@ gs_shell_installed_sort_func (GtkListBoxRow *a,
gpointer user_data)
{
GsApp *a1, *a2;
- _cleanup_free_ gchar *key1 = NULL;
- _cleanup_free_ gchar *key2 = NULL;
+ g_autofree gchar *key1 = NULL;
+ g_autofree gchar *key2 = NULL;
/* check valid */
if (!GTK_IS_BIN(a) || !GTK_IS_BIN(b)) {
@@ -458,7 +458,7 @@ gs_shell_installed_has_app (GsShellInstalled *self,
{
GList *l;
gboolean ret = FALSE;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
children = gtk_container_get_children (GTK_CONTAINER (self->list_box_install));
for (l = children; l; l = l->next) {
@@ -481,7 +481,7 @@ gs_shell_installed_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
GsApp *app;
GtkWidget *widget;
guint i;
- _cleanup_ptrarray_unref_ GPtrArray *pending = NULL;
+ g_autoptr(GPtrArray) pending = NULL;
widget = GTK_WIDGET (gtk_builder_get_object (self->builder,
"button_installed_counter"));
@@ -489,7 +489,7 @@ gs_shell_installed_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
if (pending->len == 0) {
gtk_widget_hide (widget);
} else {
- _cleanup_free_ gchar *label = NULL;
+ g_autofree gchar *label = NULL;
gtk_widget_show (widget);
label = g_strdup_printf ("%d", pending->len);
gtk_label_set_label (GTK_LABEL (widget), label);
@@ -509,7 +509,7 @@ set_selection_mode (GsShellInstalled *self, gboolean selection_mode)
GtkWidget *header;
GtkWidget *widget;
GtkStyleContext *context;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
if (self->selection_mode == selection_mode)
return;
@@ -569,7 +569,7 @@ static GList *
get_selected_apps (GsShellInstalled *self)
{
GList *l, *list;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
list = NULL;
children = gtk_container_get_children (GTK_CONTAINER (self->list_box_install));
@@ -588,8 +588,8 @@ selection_changed (GsShellInstalled *self)
GList *l;
GsApp *app;
gboolean has_folders, has_nonfolders;
- _cleanup_list_free_ GList *apps = NULL;
- _cleanup_object_unref_ GsFolders *folders = NULL;
+ g_autoptr(GList) apps = NULL;
+ g_autoptr(GsFolders) folders = NULL;
folders = gs_folders_get ();
has_folders = has_nonfolders = FALSE;
@@ -622,7 +622,7 @@ show_folder_dialog (GtkButton *button, GsShellInstalled *self)
{
GtkWidget *toplevel;
GtkWidget *dialog;
- _cleanup_list_free_ GList *apps = NULL;
+ g_autoptr(GList) apps = NULL;
toplevel = gtk_widget_get_toplevel (GTK_WIDGET (button));
apps = get_selected_apps (self);
@@ -637,8 +637,8 @@ remove_folders (GtkButton *button, GsShellInstalled *self)
{
GList *l;
GsApp *app;
- _cleanup_list_free_ GList *apps = NULL;
- _cleanup_object_unref_ GsFolders *folders = NULL;
+ g_autoptr(GList) apps = NULL;
+ g_autoptr(GsFolders) folders = NULL;
folders = gs_folders_get ();
apps = get_selected_apps (self);
@@ -659,7 +659,7 @@ static void
select_all_cb (GtkMenuItem *item, GsShellInstalled *self)
{
GList *l;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
children = gtk_container_get_children (GTK_CONTAINER (self->list_box_install));
for (l = children; l; l = l->next) {
@@ -672,7 +672,7 @@ static void
select_none_cb (GtkMenuItem *item, GsShellInstalled *self)
{
GList *l;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
children = gtk_container_get_children (GTK_CONTAINER (self->list_box_install));
for (l = children; l; l = l->next) {
diff --git a/src/gs-shell-overview.c b/src/gs-shell-overview.c
index 248858e..78dc4ca 100644
--- a/src/gs-shell-overview.c
+++ b/src/gs-shell-overview.c
@@ -133,7 +133,7 @@ gs_shell_overview_get_popular_cb (GObject *source_object,
GsApp *app;
gint i;
GtkWidget *tile;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* get popular apps */
list = gs_plugin_loader_get_popular_finish (plugin_loader, res, &error);
@@ -184,7 +184,7 @@ gs_shell_overview_get_popular_rotating_cb (GObject *source_object,
GsApp *app;
gint i;
GtkWidget *tile;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* get popular apps */
list = gs_plugin_loader_get_category_apps_finish (plugin_loader, res, &error);
@@ -250,7 +250,7 @@ gs_shell_overview_get_featured_cb (GObject *source_object,
GtkWidget *tile;
GList *list;
GsApp *app;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_get_featured_finish (plugin_loader, res, &error);
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
@@ -317,7 +317,7 @@ gs_shell_overview_get_categories_cb (GObject *source_object,
GsCategory *cat;
GtkWidget *tile;
gboolean has_category = FALSE;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_get_categories_finish (plugin_loader, res, &error);
if (list == NULL) {
@@ -361,7 +361,7 @@ gs_shell_overview_load (GsShellOverview *self)
{
GsShellOverviewPrivate *priv = gs_shell_overview_get_instance_private (self);
const gchar *category_of_day;
- _cleanup_date_time_unref_ GDateTime *date = NULL;
+ g_autoptr(GDateTime) date = NULL;
priv->empty = TRUE;
@@ -416,8 +416,8 @@ gs_shell_overview_load (GsShellOverview *self)
if (!priv->loading_popular_rotating) {
LoadData *load_data;
- _cleanup_object_unref_ GsCategory *category = NULL;
- _cleanup_object_unref_ GsCategory *featured_category = NULL;
+ g_autoptr(GsCategory) category = NULL;
+ g_autoptr(GsCategory) featured_category = NULL;
category = gs_category_new (NULL, category_of_day, NULL);
featured_category = gs_category_new (category, "featured", NULL);
diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
index 21976c7..a73ea94 100644
--- a/src/gs-shell-search-provider.c
+++ b/src/gs-shell-search-provider.c
@@ -114,7 +114,7 @@ execute_search (GsShellSearchProvider *self,
gchar **terms)
{
PendingSearch *pending_search;
- _cleanup_free_ gchar *string = NULL;
+ g_autofree gchar *string = NULL;
string = g_strjoinv (" ", terms);
@@ -186,7 +186,7 @@ handle_get_result_metas (GsShellSearchProvider2 *skeleton,
g_debug ("****** GetResultMetas");
for (i = 0; results[i]; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
if (g_hash_table_lookup (self->metas_cache, results[i]))
continue;
@@ -239,7 +239,7 @@ handle_activate_result (GsShellSearchProvider2 *skeleton,
gpointer user_data)
{
GApplication *app = g_application_get_default ();
- _cleanup_free_ gchar *string = NULL;
+ g_autofree gchar *string = NULL;
string = g_strjoinv (" ", terms);
@@ -258,7 +258,7 @@ handle_launch_search (GsShellSearchProvider2 *skeleton,
gpointer user_data)
{
GApplication *app = g_application_get_default ();
- _cleanup_free_ gchar *string = g_strjoinv (" ", terms);
+ g_autofree gchar *string = g_strjoinv (" ", terms);
g_action_group_activate_action (G_ACTION_GROUP (app), "search",
g_variant_new ("s", string));
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index bd9f62c..eebfef2 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -99,7 +99,7 @@ gs_shell_search_get_search_cb (GObject *source_object,
GsShellSearch *self = GS_SHELL_SEARCH (user_data);
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source_object);
GtkWidget *app_row;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
list = gs_plugin_loader_search_finish (plugin_loader, res, &error);
if (list == NULL) {
@@ -301,8 +301,8 @@ gs_shell_search_sort_func (GtkListBoxRow *a,
{
GsApp *a1 = gs_app_row_get_app (GS_APP_ROW (a));
GsApp *a2 = gs_app_row_get_app (GS_APP_ROW (b));
- _cleanup_free_ gchar *key1 = gs_shell_search_get_app_sort_key (a1);
- _cleanup_free_ gchar *key2 = gs_shell_search_get_app_sort_key (a2);
+ g_autofree gchar *key1 = gs_shell_search_get_app_sort_key (a1);
+ g_autofree gchar *key2 = gs_shell_search_get_app_sort_key (a2);
/* compare the keys according to the algorithm above */
return g_strcmp0 (key2, key1);
diff --git a/src/gs-shell-updates.c b/src/gs-shell-updates.c
index 382a0bb..1d7c7fd 100644
--- a/src/gs-shell-updates.c
+++ b/src/gs-shell-updates.c
@@ -104,7 +104,7 @@ time_next_midnight (void)
{
GDateTime *next_midnight;
GTimeSpan since_midnight;
- _cleanup_date_time_unref_ GDateTime *now = NULL;
+ g_autoptr(GDateTime) now = NULL;
now = g_date_time_new_now_local ();
since_midnight = g_date_time_get_hour (now) * G_TIME_SPAN_HOUR +
@@ -125,8 +125,8 @@ gs_shell_updates_last_checked_time_string (GsShellUpdates *self)
gboolean use_24h_time;
gint64 tmp;
gint days_ago;
- _cleanup_date_time_unref_ GDateTime *last_checked = NULL;
- _cleanup_date_time_unref_ GDateTime *midnight = NULL;
+ g_autoptr(GDateTime) last_checked = NULL;
+ g_autoptr(GDateTime) midnight = NULL;
g_settings_get (self->settings, "check-timestamp", "x", &tmp);
if (tmp == 0)
@@ -206,8 +206,8 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
GtkWidget *widget;
PkNetworkEnum network_state;
gboolean is_free_connection;
- _cleanup_free_ gchar *checked_str = NULL;
- _cleanup_free_ gchar *spinner_str = NULL;
+ g_autofree gchar *checked_str = NULL;
+ g_autofree gchar *spinner_str = NULL;
if (gs_shell_get_mode (self->shell) != GS_SHELL_MODE_UPDATES)
return;
@@ -400,7 +400,7 @@ gs_shell_updates_update_ui_state (GsShellUpdates *self)
if (g_strcmp0 (gtk_stack_get_visible_child_name (GTK_STACK (self->stack_updates)), "uptodate") == 0) {
checked_str = gs_shell_updates_last_checked_time_string (self);
if (checked_str != NULL) {
- _cleanup_free_ gchar *last_checked = NULL;
+ g_autofree gchar *last_checked = NULL;
/* TRANSLATORS: This is the time when we last checked for updates */
last_checked = g_strdup_printf (_("Last checked: %s"), checked_str);
@@ -446,7 +446,7 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
GList *l;
GList *list;
GtkWidget *widget;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
self->cache_valid = TRUE;
@@ -459,7 +459,7 @@ gs_shell_updates_get_updates_cb (GsPluginLoader *plugin_loader,
widget = GTK_WIDGET (gtk_builder_get_object (self->builder, "button_updates_counter"));
if (list != NULL && !gs_updates_are_managed ()) {
- _cleanup_free_ gchar *text = NULL;
+ g_autofree gchar *text = NULL;
text = g_strdup_printf ("%d", g_list_length (list));
gtk_label_set_label (GTK_LABEL (widget), text);
gtk_widget_show (widget);
@@ -607,8 +607,8 @@ gs_shell_updates_refresh_cb (GsPluginLoader *plugin_loader,
GsShellUpdates *self)
{
gboolean ret;
- _cleanup_date_time_unref_ GDateTime *now = NULL;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GDateTime) now = NULL;
+ g_autoptr(GError) error = NULL;
/* get the results */
ret = gs_plugin_loader_refresh_finish (plugin_loader, res, &error);
@@ -682,7 +682,7 @@ gs_shell_updates_get_new_updates (GsShellUpdates *self)
static void
gs_shell_updates_show_network_settings (GsShellUpdates *self)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!g_spawn_command_line_async ("gnome-control-center network", &error))
g_warning ("Failed to open the control center: %s", error->message);
}
@@ -830,7 +830,7 @@ gs_shell_updates_pending_apps_changed_cb (GsPluginLoader *plugin_loader,
static void
gs_offline_updates_cancel (void)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!pk_offline_cancel (NULL, &error))
g_warning ("failed to cancel the offline update: %s", error->message);
}
@@ -843,7 +843,7 @@ gs_shell_updates_offline_update_cb (GsPluginLoader *plugin_loader,
GAsyncResult *res,
GsShellUpdates *self)
{
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* get the results */
if (!gs_plugin_loader_offline_update_finish (plugin_loader, res, &error)) {
@@ -857,8 +857,8 @@ static void
gs_shell_updates_button_update_all_cb (GtkButton *button,
GsShellUpdates *self)
{
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_list_free_ GList *apps = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GList) apps = NULL;
/* do the offline update */
apps = gs_update_list_get_apps (GS_UPDATE_LIST (self->list_box_updates));
@@ -879,7 +879,7 @@ gs_shell_updates_get_properties_cb (GObject *source,
{
GsShellUpdates *self = GS_SHELL_UPDATES (user_data);
PkControl *control = PK_CONTROL (source);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* get result */
if (!pk_control_get_properties_finish (control, res, &error))
diff --git a/src/gs-shell.c b/src/gs-shell.c
index bbfe54f..5ab7c21 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -384,8 +384,8 @@ window_keypress_handler (GtkWidget *window, GdkEvent *event, GsShell *shell)
gboolean preedit_changed;
guint preedit_change_id;
gboolean res;
- _cleanup_free_ gchar *old_text = NULL;
- _cleanup_free_ gchar *new_text = NULL;
+ g_autofree gchar *old_text = NULL;
+ g_autofree gchar *new_text = NULL;
if (gs_shell_get_mode (shell) != GS_SHELL_MODE_OVERVIEW &&
gs_shell_get_mode (shell) != GS_SHELL_MODE_SEARCH)
@@ -815,7 +815,7 @@ gs_shell_show_search_result (GsShell *shell, const gchar *id, const gchar *searc
void
gs_shell_show_details (GsShell *shell, const gchar *id)
{
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new (id);
gs_shell_show_app (shell, app);
}
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index dde6171..250c531 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -59,9 +59,9 @@ add_source (GtkListBox *listbox, GsApp *app)
guint cnt_addon = 0;
guint cnt_apps = 0;
guint i;
- _cleanup_free_ gchar *addons_text = NULL;
- _cleanup_free_ gchar *apps_text = NULL;
- _cleanup_free_ gchar *text = NULL;
+ g_autofree gchar *addons_text = NULL;
+ g_autofree gchar *apps_text = NULL;
+ g_autofree gchar *text = NULL;
row = gs_sources_dialog_row_new ();
gs_sources_dialog_row_set_name (GS_SOURCES_DIALOG_ROW (row),
@@ -150,7 +150,7 @@ get_sources_cb (GsPluginLoader *plugin_loader,
GList *l;
GList *list;
GsApp *app;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
/* show results */
gs_stop_spinner (GTK_SPINNER (dialog->spinner));
@@ -312,7 +312,7 @@ app_removed_cb (GObject *source,
{
GsPluginLoader *plugin_loader = GS_PLUGIN_LOADER (source);
GsSourcesDialog *dialog = GS_SOURCES_DIALOG (user_data);
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
if (!gs_plugin_loader_app_action_finish (plugin_loader, res, &error)) {
g_warning ("failed to remove: %s", error->message);
@@ -397,7 +397,7 @@ static gchar *
get_os_name (void)
{
gchar *name = NULL;
- _cleanup_free_ gchar *buffer = NULL;
+ g_autofree gchar *buffer = NULL;
if (g_file_get_contents ("/etc/os-release", &buffer, NULL, NULL)) {
gchar *start, *end;
@@ -458,8 +458,8 @@ gs_sources_dialog_dispose (GObject *object)
static void
gs_sources_dialog_init (GsSourcesDialog *dialog)
{
- _cleanup_free_ gchar *label_text = NULL;
- _cleanup_free_ gchar *os_name = NULL;
+ g_autofree gchar *label_text = NULL;
+ g_autofree gchar *os_name = NULL;
gtk_widget_init_template (GTK_WIDGET (dialog));
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 64b05f1..9230f82 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -96,14 +96,14 @@ set_updates_description_ui (GsUpdateDialog *dialog, GsApp *app)
GsAppKind kind;
const GdkPixbuf *pixbuf;
const gchar *update_details;
- _cleanup_free_ gchar *update_desc = NULL;
+ g_autofree gchar *update_desc = NULL;
/* set window title */
kind = gs_app_get_kind (app);
if (kind == GS_APP_KIND_OS_UPDATE) {
gtk_window_set_title (GTK_WINDOW (dialog), gs_app_get_name (app));
} else if (gs_app_get_source_default (app) != NULL) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
tmp = g_strdup_printf ("%s %s",
gs_app_get_source_default (app),
gs_app_get_update_version (app));
@@ -120,7 +120,7 @@ set_updates_description_ui (GsUpdateDialog *dialog, GsApp *app)
* description for the update */
update_desc = g_strdup (_("No update description available."));
} else {
- _cleanup_object_unref_ GsMarkdown *markdown = NULL;
+ g_autoptr(GsMarkdown) markdown = NULL;
markdown = gs_markdown_new (GS_MARKDOWN_OUTPUT_PANGO);
gs_markdown_set_smart_quoting (markdown, FALSE);
gs_markdown_set_autocode (markdown, TRUE);
@@ -179,7 +179,7 @@ get_installed_updates_cb (GsPluginLoader *plugin_loader,
{
GList *l;
_cleanup_plugin_list_free_ GList *list = NULL;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
gs_stop_spinner (GTK_SPINNER (dialog->spinner));
@@ -226,9 +226,9 @@ gs_update_dialog_show_installed_updates (GsUpdateDialog *dialog)
time_updates_installed = pk_offline_get_results_mtime (NULL);
if (time_updates_installed > 0) {
GtkWidget *header;
- _cleanup_date_time_unref_ GDateTime *date = NULL;
- _cleanup_free_ gchar *date_str = NULL;
- _cleanup_free_ gchar *subtitle = NULL;
+ g_autoptr(GDateTime) date = NULL;
+ g_autofree gchar *date_str = NULL;
+ g_autofree gchar *subtitle = NULL;
date = g_date_time_new_from_unix_utc (time_updates_installed);
date_str = g_date_time_format (date, "%x");
diff --git a/src/gs-update-list.c b/src/gs-update-list.c
index 396790c..ed35694 100644
--- a/src/gs-update-list.c
+++ b/src/gs-update-list.c
@@ -62,7 +62,7 @@ gs_update_list_get_apps (GsUpdateList *update_list)
{
GList *apps = NULL;
GList *l;
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
children = gtk_container_get_children (GTK_CONTAINER (update_list));
for (l = children; l != NULL; l = l->next) {
@@ -162,8 +162,8 @@ list_sort_func (GtkListBoxRow *a,
{
GsApp *a1 = gs_app_row_get_app (GS_APP_ROW (a));
GsApp *a2 = gs_app_row_get_app (GS_APP_ROW (b));
- _cleanup_free_ gchar *key1 = get_app_sort_key (a1);
- _cleanup_free_ gchar *key2 = get_app_sort_key (a2);
+ g_autofree gchar *key1 = get_app_sort_key (a1);
+ g_autofree gchar *key2 = get_app_sort_key (a2);
/* compare the keys according to the algorithm above */
return g_strcmp0 (key1, key2);
diff --git a/src/gs-update-monitor.c b/src/gs-update-monitor.c
index 96d2b15..a082510 100644
--- a/src/gs-update-monitor.c
+++ b/src/gs-update-monitor.c
@@ -78,7 +78,7 @@ notify_offline_update_available (GsUpdateMonitor *monitor)
const gchar *body;
guint64 elapsed_security = 0;
guint64 security_timestamp = 0;
- _cleanup_object_unref_ GNotification *n = NULL;
+ g_autoptr(GNotification) n = NULL;
if (!g_file_query_exists (monitor->offline_update_file, NULL))
return;
@@ -156,7 +156,7 @@ show_installed_updates_notification (GsUpdateMonitor *monitor)
{
const gchar *message;
const gchar *title;
- _cleanup_object_unref_ GNotification *notification = NULL;
+ g_autoptr(GNotification) notification = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
results = pk_offline_get_results (NULL);
@@ -240,8 +240,8 @@ no_updates_for_a_week (GsUpdateMonitor *monitor)
{
GTimeSpan d;
gint64 tmp;
- _cleanup_date_time_unref_ GDateTime *last_update = NULL;
- _cleanup_date_time_unref_ GDateTime *now = NULL;
+ g_autoptr(GDateTime) last_update = NULL;
+ g_autoptr(GDateTime) now = NULL;
g_settings_get (monitor->settings, "install-timestamp", "x", &tmp);
if (tmp == 0)
@@ -268,7 +268,7 @@ package_download_finished_cb (GObject *object,
gpointer data)
{
GsUpdateMonitor *monitor = data;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
@@ -320,10 +320,10 @@ get_updates_finished_cb (GObject *object,
guint64 security_timestamp_old = 0;
guint i;
PkPackage *pkg;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *packages = NULL;
+ g_autoptr(GPtrArray) packages = NULL;
results = pk_client_generic_finish (PK_CLIENT (object), res, &error);
if (results == NULL) {
@@ -400,7 +400,7 @@ refresh_cache_finished_cb (GObject *object,
gpointer data)
{
GsUpdateMonitor *monitor = data;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
@@ -452,7 +452,7 @@ check_updates (GsUpdateMonitor *monitor)
if (monitor->check_timestamp != NULL) {
gint now_year, now_month, now_day, now_hour;
gint year, month, day;
- _cleanup_date_time_unref_ GDateTime *now = NULL;
+ g_autoptr(GDateTime) now = NULL;
now = g_date_time_new_now_local ();
diff --git a/src/gs-utils.c b/src/gs-utils.c
index 2913fff..4a6dfac 100644
--- a/src/gs-utils.c
+++ b/src/gs-utils.c
@@ -129,8 +129,8 @@ gs_grab_focus_when_mapped (GtkWidget *widget)
void
gs_app_notify_installed (GsApp *app)
{
- _cleanup_free_ gchar *summary = NULL;
- _cleanup_object_unref_ GNotification *n = NULL;
+ g_autofree gchar *summary = NULL;
+ g_autoptr(GNotification) n = NULL;
/* TRANSLATORS: this is the summary of a notification that an application
* has been successfully installed */
@@ -158,7 +158,7 @@ gs_app_notify_failed_modal (GsApp *app,
{
GtkWidget *dialog;
const gchar *title;
- _cleanup_free_ gchar *msg = NULL;
+ g_autofree gchar *msg = NULL;
title = _("Sorry, this did not work");
switch (action) {
@@ -216,8 +216,8 @@ gs_app_notify_unavailable (GsApp *app, GtkWindow *parent)
{ "Proprietary", GS_APP_LICENCE_NONFREE },
{ NULL, 0 }
};
- _cleanup_free_ gchar *origin_url = NULL;
- _cleanup_object_unref_ GSettings *settings = NULL;
+ g_autofree gchar *origin_url = NULL;
+ g_autoptr(GSettings) settings = NULL;
_cleanup_string_free_ GString *body = NULL;
_cleanup_string_free_ GString *title = NULL;
@@ -332,7 +332,7 @@ void
gs_app_show_url (GsApp *app, AsUrlKind kind)
{
const gchar *url;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GError) error = NULL;
url = gs_app_get_url (app, kind);
if (!gtk_show_uri (NULL, url, GDK_CURRENT_TIME, &error))
@@ -382,7 +382,7 @@ out:
gboolean
gs_mkdir_parent (const gchar *path, GError **error)
{
- _cleanup_free_ gchar *parent = NULL;
+ g_autofree gchar *parent = NULL;
parent = g_path_get_dirname (path);
if (g_mkdir_with_parents (parent, 0755) == -1) {
@@ -400,8 +400,8 @@ static void
reboot_done (GObject *source, GAsyncResult *res, gpointer data)
{
GCallback reboot_failed = data;
- _cleanup_variant_unref_ GVariant *ret = NULL;
- _cleanup_error_free_ GError *error = NULL;
+ g_autoptr(GVariant) ret = NULL;
+ g_autoptr(GError) error = NULL;
ret = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source), res, &error);
if (ret)
@@ -418,7 +418,7 @@ reboot_done (GObject *source, GAsyncResult *res, gpointer data)
void
gs_reboot (GCallback reboot_failed)
{
- _cleanup_object_unref_ GDBusConnection *bus = NULL;
+ g_autoptr(GDBusConnection) bus = NULL;
g_debug ("calling org.gnome.SessionManager.Reboot");
diff --git a/src/plugins/gs-moduleset.c b/src/plugins/gs-moduleset.c
index 5f5c157..c87f45c 100644
--- a/src/plugins/gs-moduleset.c
+++ b/src/plugins/gs-moduleset.c
@@ -141,7 +141,7 @@ gs_moduleset_get_featured_categories (GsModuleset *moduleset)
GsModulesetPrivate *priv = gs_moduleset_get_instance_private (moduleset);
GsModulesetEntry *entry;
guint i;
- _cleanup_hashtable_unref_ GHashTable *categories_hash = NULL;
+ g_autoptr(GHashTable) categories_hash = NULL;
g_return_val_if_fail (GS_IS_MODULESET (moduleset), NULL);
@@ -341,7 +341,7 @@ gs_moduleset_parse_filename (GsModuleset *moduleset, const gchar *filename, GErr
GMarkupParseContext *ctx;
gboolean ret;
gsize data_len;
- _cleanup_free_ gchar *data = NULL;
+ g_autofree gchar *data = NULL;
g_return_val_if_fail (GS_IS_MODULESET (moduleset), FALSE);
@@ -367,14 +367,14 @@ gboolean
gs_moduleset_parse_path (GsModuleset *moduleset, const gchar *path, GError **error)
{
const gchar *filename;
- _cleanup_dir_close_ GDir *dir = NULL;
+ g_autoptr(GDir) dir = NULL;
/* search all the files in the path */
dir = g_dir_open (path, 0, error);
if (dir == NULL)
return FALSE;
while ((filename = g_dir_read_name (dir)) != NULL) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
if (!g_str_has_suffix (filename, ".xml"))
continue;
tmp = g_build_filename (path, filename, NULL);
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 4444eaf..2be8108 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -144,7 +144,7 @@ gs_plugin_appstream_get_origins_hash (GPtrArray *array)
gdouble perc;
guint *cnt;
guint i;
- _cleanup_list_free_ GList *keys = NULL;
+ g_autoptr(GList) keys = NULL;
/* create a hash table with origin:cnt */
origins = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -188,7 +188,7 @@ gs_plugin_startup (GsPlugin *plugin, GError **error)
gchar *tmp;
guint *perc;
guint i;
- _cleanup_hashtable_unref_ GHashTable *origins = NULL;
+ g_autoptr(GHashTable) origins = NULL;
gs_profile_start (plugin->profile, "appstream::startup");
g_mutex_lock (&plugin->priv->store_mutex);
@@ -269,9 +269,9 @@ gs_plugin_refine_item_pixbuf (GsPlugin *plugin, GsApp *app, AsApp *item)
{
AsIcon *icon;
gboolean ret;
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_free_ gchar *fn = NULL;
- _cleanup_free_ gchar *path = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autofree gchar *fn = NULL;
+ g_autofree gchar *path = NULL;
icon = as_app_get_icon_default (item);
switch (as_icon_get_kind (icon)) {
@@ -354,8 +354,8 @@ gs_plugin_refine_add_addons (GsPlugin *plugin, GsApp *app, AsApp *item)
for (i = 0; i < addons->len; i++) {
AsApp *as_addon = g_ptr_array_index (addons, i);
- _cleanup_error_free_ GError *error = NULL;
- _cleanup_object_unref_ GsApp *addon = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(GsApp) addon = NULL;
addon = gs_app_new (as_app_get_id (as_addon));
@@ -538,7 +538,7 @@ gs_plugin_refine_item (GsPlugin *plugin,
if (g_hash_table_size (urls) > 0 &&
gs_app_get_url (app, AS_URL_KIND_HOMEPAGE) == NULL) {
GList *l;
- _cleanup_list_free_ GList *keys = NULL;
+ g_autoptr(GList) keys = NULL;
keys = g_hash_table_get_keys (urls);
for (l = keys; l != NULL; l = l->next) {
gs_app_set_url (app,
@@ -561,7 +561,7 @@ gs_plugin_refine_item (GsPlugin *plugin,
/* set description */
tmp = as_app_get_description (item, NULL);
if (tmp != NULL) {
- _cleanup_free_ gchar *from_xml = NULL;
+ g_autofree gchar *from_xml = NULL;
#if AS_CHECK_VERSION(0,5,0)
from_xml = as_markup_convert_simple (tmp, error);
#else
@@ -832,7 +832,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
/* just look at each app in turn */
array = as_store_get_apps (plugin->priv->store);
for (i = 0; i < array->len; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
item = g_ptr_array_index (array, i);
if (as_app_get_id (item) == NULL)
continue;
@@ -864,7 +864,7 @@ gs_plugin_add_search_item_add (GsPlugin *plugin,
guint match_value,
GError **error)
{
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new (as_app_get_id (item));
if (!gs_plugin_refine_item (plugin, app, item, error))
return FALSE;
@@ -999,7 +999,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
for (i = 0; i < array->len; i++) {
item = g_ptr_array_index (array, i);
if (as_app_get_source_kind (item) == AS_APP_SOURCE_KIND_APPDATA) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new (as_app_get_id (item));
ret = gs_plugin_refine_item (plugin, app, item, error);
if (!ret)
@@ -1027,7 +1027,7 @@ gs_plugin_add_categories_for_app (GList *list, AsApp *app)
/* does it match the main category */
for (l = list; l != NULL; l = l->next) {
- _cleanup_list_free_ GList *children = NULL;
+ g_autoptr(GList) children = NULL;
parent = GS_CATEGORY (l->data);
if (!as_app_has_category (app, gs_category_get_id (parent)))
continue;
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 4f3ba99..ef93d52 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -46,7 +46,7 @@ gs_plugin_get_name (void)
void
gs_plugin_initialize (GsPlugin *plugin)
{
- _cleanup_free_ gchar *epiphany = NULL;
+ g_autofree gchar *epiphany = NULL;
/* we can only work with epiphany */
epiphany = g_find_program_in_path ("epiphany");
@@ -83,19 +83,19 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
AsIcon *icon;
gboolean ret = TRUE;
gsize kf_length;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_free_ gchar *app_desktop = NULL;
- _cleanup_free_ gchar *epi_desktop = NULL;
- _cleanup_free_ gchar *epi_dir = NULL;
- _cleanup_free_ gchar *epi_icon = NULL;
- _cleanup_free_ gchar *exec = NULL;
- _cleanup_free_ gchar *hash = NULL;
- _cleanup_free_ gchar *id_nonfull = NULL;
- _cleanup_free_ gchar *kf_data = NULL;
- _cleanup_free_ gchar *wmclass = NULL;
- _cleanup_keyfile_unref_ GKeyFile *kf = NULL;
- _cleanup_object_unref_ GFile *symlink_desktop = NULL;
- _cleanup_object_unref_ GFile *symlink_icon = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *app_desktop = NULL;
+ g_autofree gchar *epi_desktop = NULL;
+ g_autofree gchar *epi_dir = NULL;
+ g_autofree gchar *epi_icon = NULL;
+ g_autofree gchar *exec = NULL;
+ g_autofree gchar *hash = NULL;
+ g_autofree gchar *id_nonfull = NULL;
+ g_autofree gchar *kf_data = NULL;
+ g_autofree gchar *wmclass = NULL;
+ g_autoptr(GKeyFile) kf = NULL;
+ g_autoptr(GFile) symlink_desktop = NULL;
+ g_autoptr(GFile) symlink_icon = NULL;
/* only process web apps */
if (gs_app_get_id_kind (app) != AS_ID_KIND_WEB_APP)
@@ -209,10 +209,10 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
GCancellable *cancellable, GError **error)
{
const gchar *epi_desktop;
- _cleanup_free_ gchar *basename = NULL;
- _cleanup_free_ gchar *app_desktop = NULL;
- _cleanup_object_unref_ GFile *file_epi = NULL;
- _cleanup_object_unref_ GFile *file_app = NULL;
+ g_autofree gchar *basename = NULL;
+ g_autofree gchar *app_desktop = NULL;
+ g_autoptr(GFile) file_epi = NULL;
+ g_autoptr(GFile) file_app = NULL;
/* only process this app if was created by this plugin */
if (g_strcmp0 (gs_app_get_management_plugin (app), "Epiphany") != 0)
@@ -245,9 +245,9 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
static gboolean
gs_plugin_refine_app (GsPlugin *plugin, GsApp *app, GError **error)
{
- _cleanup_free_ gchar *fn = NULL;
- _cleanup_free_ gchar *hash = NULL;
- _cleanup_free_ gchar *id_nonfull = NULL;
+ g_autofree gchar *fn = NULL;
+ g_autofree gchar *hash = NULL;
+ g_autofree gchar *id_nonfull = NULL;
id_nonfull = _gs_app_get_id_nonfull (app);
hash = g_compute_checksum_for_string (G_CHECKSUM_SHA1, gs_app_get_name (app), -1);
diff --git a/src/plugins/gs-plugin-fedora-tagger-ratings.c b/src/plugins/gs-plugin-fedora-tagger-ratings.c
index 6e8cbfa..8786d20 100644
--- a/src/plugins/gs-plugin-fedora-tagger-ratings.c
+++ b/src/plugins/gs-plugin-fedora-tagger-ratings.c
@@ -115,7 +115,7 @@ gs_plugin_parse_json (const gchar *data, gsize data_len, const gchar *key)
gchar *tmp;
guint len;
_cleanup_string_free_ GString *string = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_auto(GStrv) split = NULL;
/* format the key to match what JSON returns */
key_full = g_strdup_printf ("\"%s\":", key);
@@ -184,9 +184,9 @@ gs_plugin_app_set_rating_pkg (GsPlugin *plugin,
GError **error)
{
guint status_code;
- _cleanup_free_ gchar *data = NULL;
- _cleanup_free_ gchar *error_msg = NULL;
- _cleanup_free_ gchar *uri = NULL;
+ g_autofree gchar *data = NULL;
+ g_autofree gchar *error_msg = NULL;
+ g_autofree gchar *uri = NULL;
_cleanup_object_unref_ SoupMessage *msg = NULL;
/* create the PUT data */
@@ -293,7 +293,7 @@ gs_plugin_fedora_tagger_add (GsPlugin *plugin,
{
char *error_msg = NULL;
gint rc;
- _cleanup_free_ gchar *statement = NULL;
+ g_autofree gchar *statement = NULL;
/* insert the entry */
statement = g_strdup_printf ("INSERT OR REPLACE INTO ratings (pkgname, rating, "
@@ -325,7 +325,7 @@ gs_plugin_fedora_tagger_set_timestamp (GsPlugin *plugin,
{
char *error_msg = NULL;
gint rc;
- _cleanup_free_ gchar *statement = NULL;
+ g_autofree gchar *statement = NULL;
/* insert the entry */
statement = g_strdup_printf ("INSERT OR REPLACE INTO timestamps (key, value) "
@@ -354,10 +354,10 @@ gs_plugin_fedora_tagger_download (GsPlugin *plugin, GError **error)
gdouble count_sum = 0;
guint i;
guint status_code;
- _cleanup_free_ gchar *uri = NULL;
+ g_autofree gchar *uri = NULL;
_cleanup_object_unref_ SoupMessage *msg = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *items = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_autoptr(GPtrArray) items = NULL;
+ g_auto(GStrv) split = NULL;
/* create the GET data */
uri = g_strdup_printf ("%s/api/v1/rating/dump/",
@@ -383,7 +383,7 @@ gs_plugin_fedora_tagger_download (GsPlugin *plugin, GError **error)
items = g_ptr_array_new_with_free_func ((GDestroyNotify) fedora_tagger_item_free);
split = g_strsplit (msg->response_body->data, "\n", -1);
for (i = 0; split[i] != NULL; i++) {
- _cleanup_strv_free_ gchar **fields = NULL;
+ g_auto(GStrv) fields = NULL;
if (split[i][0] == '\0' ||
split[i][0] == '#')
continue;
@@ -456,7 +456,7 @@ gs_plugin_fedora_tagger_load_db (GsPlugin *plugin, GError **error)
gint rc;
gint64 mtime = 0;
gint64 now;
- _cleanup_error_free_ GError *error_local = NULL;
+ g_autoptr(GError) error_local = NULL;
g_debug ("trying to open database '%s'", plugin->priv->db_path);
if (!gs_mkdir_parent (plugin->priv->db_path, error))
@@ -570,7 +570,7 @@ gs_plugin_resolve_app (GsPlugin *plugin,
FedoraTaggerHelper helper;
gchar *error_msg = NULL;
gint rc;
- _cleanup_free_ gchar *statement = NULL;
+ g_autofree gchar *statement = NULL;
/* default values */
helper.rating = -1;
diff --git a/src/plugins/gs-plugin-fedora-tagger-usage.c b/src/plugins/gs-plugin-fedora-tagger-usage.c
index 220a83b..dc103aa 100644
--- a/src/plugins/gs-plugin-fedora-tagger-usage.c
+++ b/src/plugins/gs-plugin-fedora-tagger-usage.c
@@ -51,7 +51,7 @@ gs_plugin_get_name (void)
void
gs_plugin_initialize (GsPlugin *plugin)
{
- _cleanup_object_unref_ GSettings *settings = NULL;
+ g_autoptr(GSettings) settings = NULL;
plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
@@ -129,8 +129,8 @@ gs_plugin_app_set_usage_pkg (GsPlugin *plugin,
GError **error)
{
guint status_code;
- _cleanup_free_ gchar *data = NULL;
- _cleanup_free_ gchar *uri = NULL;
+ g_autofree gchar *data = NULL;
+ g_autofree gchar *uri = NULL;
_cleanup_object_unref_ SoupMessage *msg = NULL;
/* create the PUT data */
diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
index fe02673..a57ca67 100644
--- a/src/plugins/gs-plugin-fwupd.c
+++ b/src/plugins/gs-plugin-fwupd.c
@@ -131,9 +131,9 @@ gs_plugin_startup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
gint rc;
gsize len;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_free_ gchar *data = NULL;
- _cleanup_object_unref_ GDBusConnection *conn = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *data = NULL;
+ g_autoptr(GDBusConnection) conn = NULL;
/* register D-Bus errors */
fwupd_error_quark ();
@@ -215,7 +215,7 @@ gs_plugin_fwupd_get_file_checksum (const gchar *filename,
GError **error)
{
gsize len;
- _cleanup_free_ gchar *data = NULL;
+ g_autofree gchar *data = NULL;
if (!g_file_get_contents (filename, &data, &len, error))
return NULL;
@@ -235,20 +235,20 @@ gs_plugin_add_update_app (GsPlugin *plugin,
FwupdDeviceFlags flags = 0;
GVariant *variant;
const gchar *key;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_free_ gchar *basename = NULL;
- _cleanup_free_ gchar *checksum = NULL;
- _cleanup_free_ gchar *display_name = NULL;
- _cleanup_free_ gchar *filename_cache = NULL;
- _cleanup_free_ gchar *guid = NULL;
- _cleanup_free_ gchar *update_desc = NULL;
- _cleanup_free_ gchar *update_hash = NULL;
- _cleanup_free_ gchar *update_uri = NULL;
- _cleanup_free_ gchar *update_version = NULL;
- _cleanup_free_ gchar *vendor = NULL;
- _cleanup_free_ gchar *version = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *basename = NULL;
+ g_autofree gchar *checksum = NULL;
+ g_autofree gchar *display_name = NULL;
+ g_autofree gchar *filename_cache = NULL;
+ g_autofree gchar *guid = NULL;
+ g_autofree gchar *update_desc = NULL;
+ g_autofree gchar *update_hash = NULL;
+ g_autofree gchar *update_uri = NULL;
+ g_autofree gchar *update_version = NULL;
+ g_autofree gchar *vendor = NULL;
+ g_autofree gchar *version = NULL;
_cleanup_object_unref_ AsIcon *icon = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
while (g_variant_iter_next (iter_device, "{&sv}", &key, &variant)) {
if (g_strcmp0 (key, "Guid") == 0) {
@@ -349,7 +349,7 @@ gs_plugin_add_update_app (GsPlugin *plugin,
gs_app_set_metadata (app, "fwupd::DeviceID", id);
gs_app_set_metadata (app, "DataDir::desktop-icon", "application-x-firmware");
if (update_desc != NULL) {
- _cleanup_free_ gchar *md = NULL;
+ g_autofree gchar *md = NULL;
#if AS_CHECK_VERSION(0,5,0)
md = as_markup_convert (update_desc,
AS_MARKUP_CONVERT_FORMAT_MARKDOWN,
@@ -388,10 +388,10 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
GVariant *variant;
const gchar *key;
gboolean ret;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_variant_iter_free_ GVariantIter *iter = NULL;
- _cleanup_variant_unref_ GVariant *val = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_autoptr(GVariantIter) iter = NULL;
+ g_autoptr(GVariant) val = NULL;
/* watch the file in case it comes or goes */
if (g_once_init_enter (&plugin->priv->done_init)) {
@@ -466,9 +466,9 @@ gs_plugin_add_updates (GsPlugin *plugin,
const gchar *id;
gboolean ret;
GVariantIter *iter_device;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_variant_iter_free_ GVariantIter *iter = NULL;
- _cleanup_variant_unref_ GVariant *val = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autoptr(GVariantIter) iter = NULL;
+ g_autoptr(GVariant) val = NULL;
/* watch the file in case it comes or goes */
if (g_once_init_enter (&plugin->priv->done_init)) {
@@ -503,7 +503,7 @@ gs_plugin_add_updates (GsPlugin *plugin,
/* parse */
g_variant_get (val, "(a{sa{sv}})", &iter);
while (g_variant_iter_next (iter, "{&sa{sv}}", &id, &iter_device)) {
- _cleanup_error_free_ GError *error_local2 = NULL;
+ g_autoptr(GError) error_local2 = NULL;
if (!gs_plugin_add_update_app (plugin, list,
id, iter_device,
&error_local2))
@@ -524,10 +524,10 @@ gs_plugin_fwupd_update_lvfs_metadata (const gchar *data_fn, const gchar *sig_fn,
gint fd_sig;
gint fd_data;
gint retval;
- _cleanup_object_unref_ GDBusConnection *conn = NULL;
- _cleanup_object_unref_ GDBusMessage *message = NULL;
- _cleanup_object_unref_ GDBusMessage *request = NULL;
- _cleanup_object_unref_ GUnixFDList *fd_list = NULL;
+ g_autoptr(GDBusConnection) conn = NULL;
+ g_autoptr(GDBusMessage) message = NULL;
+ g_autoptr(GDBusMessage) request = NULL;
+ g_autoptr(GUnixFDList) fd_list = NULL;
conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
if (conn == NULL)
@@ -601,14 +601,14 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
GError **error)
{
guint status_code;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_free_ gchar *basename_data = NULL;
- _cleanup_free_ gchar *cache_fn_data = NULL;
- _cleanup_free_ gchar *checksum = NULL;
- _cleanup_free_ gchar *config_fn = NULL;
- _cleanup_free_ gchar *url_data = NULL;
- _cleanup_free_ gchar *url_sig = NULL;
- _cleanup_keyfile_unref_ GKeyFile *config = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *basename_data = NULL;
+ g_autofree gchar *cache_fn_data = NULL;
+ g_autofree gchar *checksum = NULL;
+ g_autofree gchar *config_fn = NULL;
+ g_autofree gchar *url_data = NULL;
+ g_autofree gchar *url_sig = NULL;
+ g_autoptr(GKeyFile) config = NULL;
_cleanup_object_unref_ SoupMessage *msg_data = NULL;
_cleanup_object_unref_ SoupMessage *msg_sig = NULL;
@@ -731,9 +731,9 @@ gs_plugin_refresh (GsPlugin *plugin,
/* download the files to the cachedir */
for (i = 0; i < plugin->priv->to_download->len; i++) {
guint status_code;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_free_ gchar *basename = NULL;
- _cleanup_free_ gchar *filename_cache = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *basename = NULL;
+ g_autofree gchar *filename_cache = NULL;
_cleanup_object_unref_ SoupMessage *msg = NULL;
tmp = g_ptr_array_index (plugin->priv->to_download, i);
@@ -783,10 +783,10 @@ gs_plugin_fwupd_upgrade (GsPlugin *plugin,
GVariantBuilder builder;
gint fd;
gint retval;
- _cleanup_object_unref_ GDBusConnection *conn = NULL;
- _cleanup_object_unref_ GDBusMessage *message = NULL;
- _cleanup_object_unref_ GDBusMessage *request = NULL;
- _cleanup_object_unref_ GUnixFDList *fd_list = NULL;
+ g_autoptr(GDBusConnection) conn = NULL;
+ g_autoptr(GDBusMessage) message = NULL;
+ g_autoptr(GDBusMessage) request = NULL;
+ g_autoptr(GUnixFDList) fd_list = NULL;
conn = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
if (conn == NULL)
@@ -944,8 +944,8 @@ gs_plugin_fwupd_content_type_matches (const gchar *filename,
{
const gchar *tmp;
guint i;
- _cleanup_object_unref_ GFile *file = NULL;
- _cleanup_object_unref_ GFileInfo *info = NULL;
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GFileInfo) info = NULL;
const gchar *mimetypes[] = {
"application/vnd.ms-cab-compressed",
NULL };
@@ -990,12 +990,12 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gint fd;
gint retval;
_cleanup_object_unref_ AsIcon *icon = NULL;
- _cleanup_object_unref_ GDBusConnection *conn = NULL;
- _cleanup_object_unref_ GDBusMessage *message = NULL;
- _cleanup_object_unref_ GDBusMessage *request = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_object_unref_ GUnixFDList *fd_list = NULL;
- _cleanup_variant_iter_free_ GVariantIter *iter = NULL;
+ g_autoptr(GDBusConnection) conn = NULL;
+ g_autoptr(GDBusMessage) message = NULL;
+ g_autoptr(GDBusMessage) request = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_autoptr(GUnixFDList) fd_list = NULL;
+ g_autoptr(GVariantIter) iter = NULL;
/* does this match any of the mimetypes we support */
if (!gs_plugin_fwupd_content_type_matches (filename,
@@ -1079,7 +1079,7 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gs_app_set_summary (app, GS_APP_QUALITY_NORMAL,
g_variant_get_string (variant, NULL));
} else if (g_strcmp0 (key, "Description") == 0) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
#if AS_CHECK_VERSION(0,5,0)
tmp = as_markup_convert (g_variant_get_string (variant, NULL),
AS_MARKUP_CONVERT_FORMAT_SIMPLE, NULL);
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 7dff856..87a7522 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -42,11 +42,11 @@ gs_plugin_add_featured_app (GList **list,
const gchar *id,
GError **error)
{
- _cleanup_free_ gchar *background = NULL;
- _cleanup_free_ gchar *stroke_color = NULL;
- _cleanup_free_ gchar *text_color = NULL;
- _cleanup_free_ gchar *text_shadow = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autofree gchar *background = NULL;
+ g_autofree gchar *stroke_color = NULL;
+ g_autofree gchar *text_color = NULL;
+ g_autofree gchar *text_shadow = NULL;
+ g_autoptr(GsApp) app = NULL;
background = g_key_file_get_string (kf, id, "background", error);
if (background == NULL)
@@ -83,9 +83,9 @@ gs_plugin_add_featured (GsPlugin *plugin,
GError **error)
{
guint i;
- _cleanup_free_ gchar *path = NULL;
- _cleanup_keyfile_unref_ GKeyFile *kf = NULL;
- _cleanup_strv_free_ gchar **apps = NULL;
+ g_autofree gchar *path = NULL;
+ g_autoptr(GKeyFile) kf = NULL;
+ g_auto(GStrv) apps = NULL;
path = g_build_filename (DATADIR, "gnome-software", "featured.ini", NULL);
kf = g_key_file_new ();
diff --git a/src/plugins/gs-plugin-icons.c b/src/plugins/gs-plugin-icons.c
index 62fc530..46de16d 100644
--- a/src/plugins/gs-plugin-icons.c
+++ b/src/plugins/gs-plugin-icons.c
@@ -109,9 +109,9 @@ static gboolean
gs_plugin_icons_download (GsPlugin *plugin, const gchar *uri, const gchar *filename, GError **error)
{
guint status_code;
- _cleanup_object_unref_ GdkPixbuf *pixbuf_new = NULL;
- _cleanup_object_unref_ GdkPixbuf *pixbuf = NULL;
- _cleanup_object_unref_ GInputStream *stream = NULL;
+ g_autoptr(GdkPixbuf) pixbuf_new = NULL;
+ g_autoptr(GdkPixbuf) pixbuf = NULL;
+ g_autoptr(GInputStream) stream = NULL;
_cleanup_object_unref_ SoupMessage *msg = NULL;
/* create the GET data */
diff --git a/src/plugins/gs-plugin-limba.c b/src/plugins/gs-plugin-limba.c
index 485ae8b..205dcf2 100644
--- a/src/plugins/gs-plugin-limba.c
+++ b/src/plugins/gs-plugin-limba.c
@@ -144,7 +144,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
- _cleanup_object_unref_ LiManager *mgr = NULL;
+ g_autoptr(LiManager) mgr = NULL;
AsBundle *bundle;
GError *local_error = NULL;
@@ -182,7 +182,7 @@ gs_plugin_app_install (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
- _cleanup_object_unref_ LiInstaller *inst = NULL;
+ g_autoptr(LiInstaller) inst = NULL;
AsBundle *bundle;
GError *local_error = NULL;
diff --git a/src/plugins/gs-plugin-local-ratings.c b/src/plugins/gs-plugin-local-ratings.c
index d82be80..349af3e 100644
--- a/src/plugins/gs-plugin-local-ratings.c
+++ b/src/plugins/gs-plugin-local-ratings.c
@@ -139,7 +139,7 @@ static gint
gs_plugin_local_find_app (GsPlugin *plugin, const gchar *app_id)
{
gint rating = -1;
- _cleanup_free_ gchar *statement = NULL;
+ g_autofree gchar *statement = NULL;
statement = g_strdup_printf ("SELECT rating FROM ratings WHERE app_id = '%s'", app_id);
sqlite3_exec (plugin->priv->db,
@@ -162,7 +162,7 @@ gs_plugin_app_set_rating (GsPlugin *plugin,
char *error_msg = NULL;
gboolean ret;
gint rc;
- _cleanup_free_ gchar *statement = NULL;
+ g_autofree gchar *statement = NULL;
/* already loaded */
if (g_once_init_enter (&plugin->priv->loaded)) {
diff --git a/src/plugins/gs-plugin-menu-spec-categories.c b/src/plugins/gs-plugin-menu-spec-categories.c
index a8240b9..c1077a3 100644
--- a/src/plugins/gs-plugin-menu-spec-categories.c
+++ b/src/plugins/gs-plugin-menu-spec-categories.c
@@ -61,7 +61,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
*list = g_list_prepend (*list, category);
g_snprintf(msgctxt, 100, "Menu subcategory of %s", msdata[i].text);
} else {
- _cleanup_object_unref_ GsCategory *sub = NULL;
+ g_autoptr(GsCategory) sub = NULL;
sub = gs_category_new (category,
tmp + 2,
g_dpgettext2(GETTEXT_PACKAGE, msgctxt, msdata[i].text));
diff --git a/src/plugins/gs-plugin-menu-spec-refine.c b/src/plugins/gs-plugin-menu-spec-refine.c
index 7af5e22..a83e0c7 100644
--- a/src/plugins/gs-plugin-menu-spec-refine.c
+++ b/src/plugins/gs-plugin-menu-spec-refine.c
@@ -72,8 +72,8 @@ gs_plugin_refine_app_category (GsPlugin *plugin,
continue;
ret = gs_app_has_category (app, tmp + 2);
if (ret) {
- _cleanup_free_ gchar *str = NULL;
- _cleanup_free_ gchar *msgctxt = NULL;
+ g_autofree gchar *str = NULL;
+ g_autofree gchar *msgctxt = NULL;
msgctxt = g_strdup_printf ("Menu subcategory of %s", cat->text);
str = g_strdup_printf ("%s → %s",
gettext (cat->text),
diff --git a/src/plugins/gs-plugin-moduleset.c b/src/plugins/gs-plugin-moduleset.c
index 1c4bb5b..b321377 100644
--- a/src/plugins/gs-plugin-moduleset.c
+++ b/src/plugins/gs-plugin-moduleset.c
@@ -103,7 +103,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
GsCategory *parent;
const gchar *id;
guint i;
- _cleanup_strv_free_ gchar **categories = NULL;
+ g_auto(GStrv) categories = NULL;
/* load XML files */
if (g_once_init_enter (&plugin->priv->done_init)) {
@@ -128,7 +128,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
id = gs_category_get_id (parent);
if (g_strcmp0 (categories[i], id) == 0) {
guint size;
- _cleanup_object_unref_ GsCategory *cat = NULL;
+ g_autoptr(GsCategory) cat = NULL;
cat = gs_category_new (parent, "featured", _("Featured"));
gs_category_add_subcategory (parent, cat);
@@ -162,7 +162,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
/* Populate the "featured" subcategory */
if (g_strcmp0 (gs_category_get_id (category), "featured") == 0) {
- _cleanup_strv_free_ gchar **apps = NULL;
+ g_auto(GStrv) apps = NULL;
parent = gs_category_get_parent (category);
if (parent != NULL) {
@@ -179,7 +179,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
/* just add all */
for (i = 0; apps[i]; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new (apps[i]);
gs_plugin_add_app (list, app);
}
@@ -199,7 +199,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
{
gboolean ret = TRUE;
guint i;
- _cleanup_strv_free_ gchar **apps = NULL;
+ g_auto(GStrv) apps = NULL;
/* load XML files */
if (g_once_init_enter (&plugin->priv->done_init)) {
@@ -224,7 +224,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
/* just add all */
for (i = 0; apps[i]; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
app = gs_app_new (apps[i]);
gs_plugin_add_app (list, app);
}
@@ -245,10 +245,10 @@ gs_plugin_refine (GsPlugin *plugin,
GsApp *app;
gboolean ret = TRUE;
guint i;
- _cleanup_strv_free_ gchar **featured_apps = NULL;
- _cleanup_strv_free_ gchar **popular_apps = NULL;
- _cleanup_strv_free_ gchar **system_apps = NULL;
- _cleanup_strv_free_ gchar **core_pkgs = NULL;
+ g_auto(GStrv) featured_apps = NULL;
+ g_auto(GStrv) popular_apps = NULL;
+ g_auto(GStrv) system_apps = NULL;
+ g_auto(GStrv) core_pkgs = NULL;
/* load XML files */
if (g_once_init_enter (&plugin->priv->done_init)) {
diff --git a/src/plugins/gs-plugin-packagekit-history.c b/src/plugins/gs-plugin-packagekit-history.c
index caa8f18..2983493 100644
--- a/src/plugins/gs-plugin-packagekit-history.c
+++ b/src/plugins/gs-plugin-packagekit-history.c
@@ -85,7 +85,7 @@ gs_plugin_packagekit_refine_add_history (GsApp *app, GVariant *dict)
gboolean ret;
guint64 timestamp;
PkInfoEnum info_enum;
- _cleanup_object_unref_ GsApp *history = NULL;
+ g_autoptr(GsApp) history = NULL;
/* create new history item with same ID as parent */
history = gs_app_new (gs_app_get_id (app));
@@ -153,9 +153,9 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
guint i = 0;
GVariantIter iter;
GVariant *value;
- _cleanup_free_ const gchar **package_names = NULL;
- _cleanup_variant_unref_ GVariant *result = NULL;
- _cleanup_variant_unref_ GVariant *tuple = NULL;
+ g_autofree const gchar **package_names = NULL;
+ g_autoptr(GVariant) result = NULL;
+ g_autoptr(GVariant) tuple = NULL;
/* already loaded */
if (g_once_init_enter (&plugin->priv->loaded)) {
@@ -227,7 +227,7 @@ gs_plugin_packagekit_refine (GsPlugin *plugin,
/* make up a fake entry as we know this package was at
* least installed at some point in time */
if (gs_app_get_state (app) == AS_APP_STATE_INSTALLED) {
- _cleanup_object_unref_ GsApp *app_dummy = NULL;
+ g_autoptr(GsApp) app_dummy = NULL;
app_dummy = gs_app_new (gs_app_get_id (app));
gs_app_set_install_date (app_dummy, GS_APP_INSTALL_DATE_UNKNOWN);
gs_app_set_kind (app_dummy, GS_APP_KIND_PACKAGE);
@@ -263,7 +263,7 @@ gs_plugin_refine (GsPlugin *plugin,
GList *l;
GsApp *app;
GPtrArray *sources;
- _cleanup_list_free_ GList *packages = NULL;
+ g_autoptr(GList) packages = NULL;
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY) == 0)
return TRUE;
diff --git a/src/plugins/gs-plugin-packagekit-offline.c b/src/plugins/gs-plugin-packagekit-offline.c
index 70a8fba..facdc60 100644
--- a/src/plugins/gs-plugin-packagekit-offline.c
+++ b/src/plugins/gs-plugin-packagekit-offline.c
@@ -47,10 +47,10 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
{
gboolean ret;
guint i;
- _cleanup_strv_free_ gchar **package_ids = NULL;
- _cleanup_free_ gchar *error_details = NULL;
- _cleanup_free_ gchar *packages = NULL;
- _cleanup_keyfile_unref_ GKeyFile *key_file = NULL;
+ g_auto(GStrv) package_ids = NULL;
+ g_autofree gchar *error_details = NULL;
+ g_autofree gchar *packages = NULL;
+ g_autoptr(GKeyFile) key_file = NULL;
/* was any offline update attempted */
if (!g_file_test (PK_OFFLINE_UPDATE_RESULTS_FILENAME, G_FILE_TEST_EXISTS))
@@ -99,8 +99,8 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
}
package_ids = g_strsplit (packages, ",", -1);
for (i = 0; package_ids[i] != NULL; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_auto(GStrv) split = NULL;
app = gs_app_new (NULL);
split = g_strsplit (package_ids[i], ";", 4);
gs_app_add_source (app, split[0]);
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 9145ab2..10c5e70 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -230,7 +230,7 @@ gs_plugin_packagekit_resolve_packages_app (GsPlugin *plugin,
gs_app_set_state (app, AS_APP_STATE_UNKNOWN);
gs_app_set_state (app, AS_APP_STATE_UPDATABLE);
} else if (number_installed + number_available < sources->len) {
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
/* we have less packages returned than source packages */
tmp = gs_app_to_string (app);
g_debug ("Failed to find all packages for:\n%s", tmp);
@@ -255,8 +255,8 @@ gs_plugin_packagekit_resolve_packages (GsPlugin *plugin,
guint i;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *package_ids = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *packages = NULL;
+ g_autoptr(GPtrArray) package_ids = NULL;
+ g_autoptr(GPtrArray) packages = NULL;
package_ids = g_ptr_array_new_with_free_func (g_free);
for (l = list; l != NULL; l = l->next) {
@@ -310,7 +310,7 @@ gs_plugin_packagekit_refine_from_desktop (GsPlugin *plugin,
const gchar *to_array[] = { NULL, NULL };
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *packages = NULL;
+ g_autoptr(GPtrArray) packages = NULL;
to_array[0] = filename;
results = pk_client_search_files (plugin->priv->client,
@@ -364,9 +364,9 @@ gs_plugin_packagekit_refine_updatedetails (GsPlugin *plugin,
guint i = 0;
guint size;
PkUpdateDetail *update_detail;
- _cleanup_free_ const gchar **package_ids = NULL;
+ g_autofree const gchar **package_ids = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array = NULL;
size = g_list_length (list);
package_ids = g_new0 (const gchar *, size + 1);
@@ -424,8 +424,8 @@ static gboolean
gs_pk_compare_ids (const gchar *package_id1, const gchar *package_id2)
{
gboolean ret;
- _cleanup_strv_free_ gchar **split1 = NULL;
- _cleanup_strv_free_ gchar **split2 = NULL;
+ g_auto(GStrv) split1 = NULL;
+ g_auto(GStrv) split2 = NULL;
split1 = pk_package_id_split (package_id1);
split2 = pk_package_id_split (package_id2);
@@ -457,7 +457,7 @@ gs_plugin_packagekit_refine_details_app (GsPlugin *plugin,
for (j = 0; j < source_ids->len; j++) {
package_id = g_ptr_array_index (source_ids, j);
for (i = 0; i < array->len; i++) {
- _cleanup_free_ gchar *desc = NULL;
+ g_autofree gchar *desc = NULL;
/* right package? */
details = g_ptr_array_index (array, i);
if (!gs_pk_compare_ids (package_id,
@@ -502,8 +502,8 @@ gs_plugin_packagekit_refine_details (GsPlugin *plugin,
GsApp *app;
const gchar *package_id;
guint i;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *package_ids = NULL;
+ g_autoptr(GPtrArray) array = NULL;
+ g_autoptr(GPtrArray) package_ids = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
package_ids = g_ptr_array_new_with_free_func (g_free);
@@ -564,7 +564,7 @@ gs_plugin_refine_require_details (GsPlugin *plugin,
GList *l;
GsApp *app;
gboolean ret = TRUE;
- _cleanup_list_free_ GList *list_tmp = NULL;
+ g_autoptr(GList) list_tmp = NULL;
gs_profile_start (plugin->profile, "packagekit-refine[source->licence]");
for (l = list; l != NULL; l = l->next) {
@@ -601,7 +601,7 @@ gs_plugin_packagekit_get_source_list (GsPlugin *plugin,
PkRepoDetail *rd;
guint i;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array = NULL;
/* ask PK for the repo details */
results = pk_client_get_repo_list (plugin->priv->client,
@@ -705,8 +705,8 @@ gs_plugin_refine (GsPlugin *plugin,
const gchar *profile_id = NULL;
const gchar *tmp;
gboolean ret = TRUE;
- _cleanup_list_free_ GList *resolve_all = NULL;
- _cleanup_list_free_ GList *updatedetails_all = NULL;
+ g_autoptr(GList) resolve_all = NULL;
+ g_autoptr(GList) updatedetails_all = NULL;
/* get the repo_id -> repo_name mapping set up */
if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN) > 0 &&
diff --git a/src/plugins/gs-plugin-packagekit-refresh.c b/src/plugins/gs-plugin-packagekit-refresh.c
index e1d25d9..0839028 100644
--- a/src/plugins/gs-plugin-packagekit-refresh.c
+++ b/src/plugins/gs-plugin-packagekit-refresh.c
@@ -109,7 +109,7 @@ gs_plugin_refresh (GsPlugin *plugin,
{
PkBitfield filter;
PkBitfield transaction_flags;
- _cleanup_strv_free_ gchar **package_ids = NULL;
+ g_auto(GStrv) package_ids = NULL;
_cleanup_object_unref_ PkPackageSack *sack = NULL;
_cleanup_object_unref_ PkResults *results2 = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
@@ -159,7 +159,7 @@ static void
gs_plugin_packagekit_refresh_set_text (GsApp *app, const gchar *text)
{
gchar *nl;
- _cleanup_free_ gchar *tmp = NULL;
+ g_autofree gchar *tmp = NULL;
if (text == NULL || text[0] == '\0')
return;
@@ -191,8 +191,8 @@ gs_plugin_packagekit_refresh_content_type_matches (const gchar *filename,
{
const gchar *tmp;
guint i;
- _cleanup_object_unref_ GFile *file = NULL;
- _cleanup_object_unref_ GFileInfo *info = NULL;
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GFileInfo) info = NULL;
const gchar *mimetypes[] = {
"application/x-app-package",
"application/x-deb",
@@ -236,11 +236,11 @@ gs_plugin_filename_to_app (GsPlugin *plugin,
gboolean supported;
PkDetails *item;
PkResults *results = NULL;
- _cleanup_free_ gchar *basename = NULL;
- _cleanup_strv_free_ gchar **files = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autofree gchar *basename = NULL;
+ g_auto(GStrv) files = NULL;
+ g_auto(GStrv) split = NULL;
+ g_autoptr(GPtrArray) array = NULL;
+ g_autoptr(GsApp) app = NULL;
/* does this match any of the mimetypes we support */
if (!gs_plugin_packagekit_refresh_content_type_matches (filename,
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index c68454b..b0539fb 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -194,7 +194,7 @@ gs_plugin_add_sources_related (GsPlugin *plugin,
if (!ret)
goto out;
for (l = installed; l != NULL; l = l->next) {
- _cleanup_strv_free_ gchar **split = NULL;
+ g_auto(GStrv) split = NULL;
app = GS_APP (l->data);
split = pk_package_id_split (gs_app_get_source_id_default (app));
if (g_str_has_prefix (split[PK_PACKAGE_ID_DATA], "installed:")) {
@@ -227,9 +227,9 @@ gs_plugin_add_sources (GsPlugin *plugin,
ProgressData data;
const gchar *id;
guint i;
- _cleanup_hashtable_unref_ GHashTable *hash = NULL;
+ g_autoptr(GHashTable) hash = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array = NULL;
data.app = NULL;
data.plugin = plugin;
@@ -249,7 +249,7 @@ gs_plugin_add_sources (GsPlugin *plugin,
hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
array = pk_results_get_repo_detail_array (results);
for (i = 0; i < array->len; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
rd = g_ptr_array_index (array, i);
id = pk_repo_detail_get_id (rd);
app = gs_app_new (id);
@@ -315,8 +315,8 @@ gs_plugin_app_install (GsPlugin *plugin,
guint i, j;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array_package_ids = NULL;
- _cleanup_strv_free_ gchar **package_ids = NULL;
+ g_autoptr(GPtrArray) array_package_ids = NULL;
+ g_auto(GStrv) package_ids = NULL;
data.app = app;
data.plugin = plugin;
@@ -501,7 +501,7 @@ gs_plugin_app_source_remove (GsPlugin *plugin,
GError **error)
{
ProgressData data;
- _cleanup_error_free_ GError *error_local = NULL;
+ g_autoptr(GError) error_local = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
data.app = NULL;
@@ -542,7 +542,7 @@ gs_plugin_app_remove (GsPlugin *plugin,
guint cnt = 0;
_cleanup_object_unref_ PkError *error_code = NULL;
_cleanup_object_unref_ PkResults *results = NULL;
- _cleanup_strv_free_ gchar **package_ids = NULL;
+ g_auto(GStrv) package_ids = NULL;
data.app = NULL;
data.plugin = plugin;
diff --git a/src/plugins/gs-plugin-systemd-updates.c b/src/plugins/gs-plugin-systemd-updates.c
index 264da63..9d82e22 100644
--- a/src/plugins/gs-plugin-systemd-updates.c
+++ b/src/plugins/gs-plugin-systemd-updates.c
@@ -100,8 +100,8 @@ gs_plugin_add_updates (GsPlugin *plugin,
{
gboolean ret;
guint i;
- _cleanup_error_free_ GError *error_local = NULL;
- _cleanup_strv_free_ gchar **package_ids = NULL;
+ g_autoptr(GError) error_local = NULL;
+ g_auto(GStrv) package_ids = NULL;
/* watch the file in case it comes or goes */
if (g_once_init_enter (&plugin->priv->done_init)) {
@@ -129,8 +129,8 @@ gs_plugin_add_updates (GsPlugin *plugin,
/* add them to the new array */
for (i = 0; package_ids[i] != NULL; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
- _cleanup_strv_free_ gchar **split = NULL;
+ g_autoptr(GsApp) app = NULL;
+ g_auto(GStrv) split = NULL;
app = gs_app_new (NULL);
gs_app_set_management_plugin (app, "PackageKit");
gs_app_add_source_id (app, package_ids[i]);
diff --git a/src/plugins/gs-self-test.c b/src/plugins/gs-self-test.c
index f5e1130..30a6db6 100644
--- a/src/plugins/gs-self-test.c
+++ b/src/plugins/gs-self-test.c
@@ -35,7 +35,7 @@ moduleset_func (void)
gboolean ret;
gchar **data;
GError *error = NULL;
- _cleanup_object_unref_ GsModuleset *ms = NULL;
+ g_autoptr(GsModuleset) ms = NULL;
/* not avaiable in make distcheck */
if (!g_file_test ("./moduleset-test.xml", G_FILE_TEST_EXISTS))
diff --git a/src/plugins/packagekit-common.c b/src/plugins/packagekit-common.c
index 3e8b56a..6f0b6a0 100644
--- a/src/plugins/packagekit-common.c
+++ b/src/plugins/packagekit-common.c
@@ -96,10 +96,10 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
const gchar *package_id;
guint i;
PkPackage *package;
- _cleanup_hashtable_unref_ GHashTable *installed = NULL;
+ g_autoptr(GHashTable) installed = NULL;
_cleanup_object_unref_ PkError *error_code = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array_filtered = NULL;
- _cleanup_ptrarray_unref_ GPtrArray *array = NULL;
+ g_autoptr(GPtrArray) array_filtered = NULL;
+ g_autoptr(GPtrArray) array = NULL;
/* check error code */
error_code = pk_results_get_error_code (results);
@@ -141,7 +141,7 @@ gs_plugin_packagekit_add_results (GsPlugin *plugin,
/* process packages */
for (i = 0; i < array_filtered->len; i++) {
- _cleanup_object_unref_ GsApp *app = NULL;
+ g_autoptr(GsApp) app = NULL;
package = g_ptr_array_index (array_filtered, i);
app = gs_app_new (NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]