[gnome-software] trivial: Add some clang-specific asserts for a clean compile



commit cd64467130f185175d47d3706ce74ae3e34cd690
Author: Richard Hughes <richard hughsie com>
Date:   Mon Jul 18 10:27:12 2016 +0100

    trivial: Add some clang-specific asserts for a clean compile

 src/gs-cmd.c                              |    1 +
 src/gs-debug.c                            |    1 +
 src/gs-main.c                             |    1 +
 src/gs-plugin-loader.c                    |   18 ++++++++++++++++++
 src/gs-shell-extras.c                     |    1 +
 src/plugins/gs-flatpak.c                  |    6 ++++++
 src/plugins/gs-plugin-appstream.c         |    6 ++++++
 src/plugins/gs-plugin-packagekit-refine.c |    1 +
 src/plugins/gs-plugin-packagekit.c        |    1 +
 9 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 12b454c..48d34f6 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -265,6 +265,7 @@ main (int argc, char **argv)
 
        profile = as_profile_new ();
        ptask = as_profile_start_literal (profile, "GsCmd");
+       g_assert (ptask != NULL);
 
        /* load plugins */
        plugin_loader = gs_plugin_loader_new ();
diff --git a/src/gs-debug.c b/src/gs-debug.c
index 318cfa6..c220ea8 100644
--- a/src/gs-debug.c
+++ b/src/gs-debug.c
@@ -55,6 +55,7 @@ gs_debug_handler_cb (const gchar *log_domain,
 
        /* make threadsafe */
        locker = g_mutex_locker_new (&debug->mutex);
+       g_assert (locker != NULL);
 
        /* time header */
        if (debug->use_time) {
diff --git a/src/gs-main.c b/src/gs-main.c
index bd6bda9..156b284 100644
--- a/src/gs-main.c
+++ b/src/gs-main.c
@@ -48,6 +48,7 @@ main (int argc, char **argv)
 
        profile = as_profile_new ();
        ptask = as_profile_start_literal (profile, "GsMain");
+       g_assert (ptask != NULL);
 
        /* redirect logs */
        application = gs_application_new ();
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index c493338..25c7cdd 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -339,6 +339,7 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
                                                  function_name_parent,
                                                  function_name);
                }
+               g_assert (ptask != NULL);
 
                /* run the batched plugin symbol then the per-app plugin */
                if (plugin_func != NULL) {
@@ -584,6 +585,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
 
        /* profile */
        ptask = as_profile_start (priv->profile, "GsPlugin::*(%s)", function_name);
+       g_assert (ptask != NULL);
 
        /* run each plugin */
        list = gs_app_list_new ();
@@ -610,6 +612,7 @@ gs_plugin_loader_run_results (GsPluginLoader *plugin_loader,
                                           "GsPlugin::%s(%s)",
                                           gs_plugin_get_name (plugin),
                                           function_name);
+               g_assert (ptask2 != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, list, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -934,6 +937,7 @@ gs_plugin_loader_run_action (GsPluginLoader *plugin_loader,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, app, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -1778,6 +1782,7 @@ gs_plugin_loader_search_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, values, state->list,
                                   cancellable, &error_local);
@@ -1942,6 +1947,7 @@ gs_plugin_loader_search_files_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, values, state->list,
                                   cancellable, &error_local);
@@ -2107,6 +2113,7 @@ gs_plugin_loader_search_what_provides_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, values, state->list,
                                   cancellable, &error_local);
@@ -2316,6 +2323,7 @@ gs_plugin_loader_get_categories_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->catlist,
                                   cancellable, &error_local);
@@ -2448,6 +2456,7 @@ gs_plugin_loader_get_category_apps_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->category, state->list,
                                   cancellable, &error_local);
@@ -2773,6 +2782,7 @@ gs_plugin_loader_review_action_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          state->function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->app, state->review,
                                   cancellable, &error_local);
@@ -3166,6 +3176,7 @@ gs_plugin_loader_auth_action_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          state->function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->auth, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -3307,6 +3318,7 @@ gs_plugin_loader_run (GsPluginLoader *plugin_loader, const gchar *function_name)
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                plugin_func (plugin);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -3549,6 +3561,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
 
        /* search in the plugin directory for plugins */
        ptask = as_profile_start_literal (priv->profile, "GsPlugin::setup");
+       g_assert (ptask != NULL);
        dir = g_dir_open (priv->location, 0, error);
        if (dir == NULL)
                return FALSE;
@@ -3759,6 +3772,7 @@ gs_plugin_loader_setup (GsPluginLoader *plugin_loader,
                                           "GsPlugin::%s(%s)",
                                           gs_plugin_get_name (plugin),
                                           function_name);
+               g_assert (ptask2 != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, TRUE);
                ret = plugin_func (plugin, NULL, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -4042,6 +4056,7 @@ gs_plugin_loader_run_refresh (GsPluginLoader *plugin_loader,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, TRUE);
                ret = plugin_func (plugin, cache_age, flags, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -4191,6 +4206,7 @@ gs_plugin_loader_file_to_app_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->list, state->file,
                                   cancellable, &error_local);
@@ -4369,6 +4385,7 @@ gs_plugin_loader_update_thread_cb (GTask *task,
                                          "GsPlugin::%s(%s)",
                                          gs_plugin_get_name (plugin),
                                          function_name);
+               g_assert (ptask != NULL);
                gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                ret = plugin_func (plugin, state->list, cancellable, &error_local);
                gs_plugin_loader_action_stop (plugin_loader, plugin);
@@ -4417,6 +4434,7 @@ gs_plugin_loader_update_thread_cb (GTask *task,
                                                  gs_plugin_get_name (plugin),
                                                  function_name,
                                                  gs_app_get_id (app));
+                       g_assert (ptask != NULL);
                        gs_plugin_loader_action_start (plugin_loader, plugin, FALSE);
                        ret = plugin_app_func (plugin, app,
                                               cancellable,
diff --git a/src/gs-shell-extras.c b/src/gs-shell-extras.c
index 8be12b5..df17424 100644
--- a/src/gs-shell-extras.c
+++ b/src/gs-shell-extras.c
@@ -498,6 +498,7 @@ show_search_results (GsShellExtras *self)
        } else if (n_children == 1) {
                /* switch directly to details view */
                g_debug ("extras: found one result, showing in details view");
+               g_assert (list != NULL);
                app = gs_app_row_get_app (GS_APP_ROW (list->data));
                gs_shell_change_mode (self->shell, GS_SHELL_MODE_DETAILS, app, TRUE);
        } else {
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index f59bf6b..c389c44 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -87,6 +87,7 @@ gs_flatpak_setup (GsFlatpak *self, GCancellable *cancellable, GError **error)
        /* we use a permissions helper to elevate privs */
        ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
                                          "flatpak::ensure-origin");
+       g_assert (ptask != NULL);
        destdir = g_getenv ("GS_SELF_TEST_FLATPACK_DATADIR");
        if (destdir != NULL) {
                g_autofree gchar *full_path = g_build_filename (destdir,
@@ -683,6 +684,7 @@ gs_plugin_refine_item_origin_ui (GsFlatpak *self, GsApp *app,
        /* find list of remotes */
        ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
                                          "flatpak::refine-origin-ui");
+       g_assert (ptask != NULL);
        xremotes = flatpak_installation_list_remotes (self->installation,
                                                      cancellable,
                                                      error);
@@ -853,6 +855,7 @@ gs_plugin_refine_item_origin (GsFlatpak *self,
        /* ensure metadata exists */
        ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
                                          "flatpak::refine-origin");
+       g_assert (ptask != NULL);
        if (!gs_refine_item_metadata (self, app, cancellable, error))
                return FALSE;
 
@@ -951,6 +954,7 @@ gs_plugin_refine_item_state (GsFlatpak *self,
        /* get apps and runtimes */
        ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
                                          "flatpak::refine-action");
+       g_assert (ptask != NULL);
        xrefs = flatpak_installation_list_installed_refs (self->installation,
                                                          cancellable, error);
        if (xrefs == NULL)
@@ -1195,6 +1199,7 @@ gs_plugin_refine_item_size (GsFlatpak *self,
        /* just get the size of the app */
        ptask = as_profile_start_literal (gs_plugin_get_profile (self->plugin),
                                          "flatpak::refine-size");
+       g_assert (ptask != NULL);
        if (!gs_plugin_refine_item_origin (self, app,
                                           cancellable, error))
                return FALSE;
@@ -1237,6 +1242,7 @@ gs_flatpak_refine_app (GsFlatpak *self,
        ptask = as_profile_start (gs_plugin_get_profile (self->plugin),
                                  "flatpak::refine{%s}",
                                  gs_app_get_id (app));
+       g_assert (ptask != NULL);
 
        /* flatpak apps can always be removed */
        gs_app_remove_quirk (app, AS_APP_QUIRK_COMPULSORY);
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index daaa9fc..d39d716 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -528,6 +528,7 @@ gs_plugin_add_category_apps (GsPlugin *plugin,
        /* just look at each app in turn */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::add-category-apps");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        desktop_groups = gs_category_get_desktop_groups (category);
        if (desktop_groups->len == 0) {
@@ -615,6 +616,7 @@ gs_plugin_add_search (GsPlugin *plugin,
        /* search categories for the search term */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::search");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        for (i = 0; i < array->len; i++) {
                if (g_cancellable_set_error_if_cancelled (cancellable, error))
@@ -643,6 +645,7 @@ gs_plugin_add_installed (GsPlugin *plugin,
        /* search categories for the search term */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::add_installed");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        for (i = 0; i < array->len; i++) {
                item = g_ptr_array_index (array, i);
@@ -703,6 +706,7 @@ gs_plugin_add_categories (GsPlugin *plugin,
        /* find out how many packages are in each category */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::add-categories");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        for (i = 0; i < array->len; i++) {
                app = g_ptr_array_index (array, i);
@@ -733,6 +737,7 @@ gs_plugin_add_popular (GsPlugin *plugin,
        /* find out how many packages are in each category */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::add-popular");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        for (i = 0; i < array->len; i++) {
                g_autoptr(GsApp) app = NULL;
@@ -763,6 +768,7 @@ gs_plugin_add_featured (GsPlugin *plugin,
        /* find out how many packages are in each category */
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "appstream::add-featured");
+       g_assert (ptask != NULL);
        array = as_store_get_apps (priv->store);
        for (i = 0; i < array->len; i++) {
                g_autoptr(GsApp) app = NULL;
diff --git a/src/plugins/gs-plugin-packagekit-refine.c b/src/plugins/gs-plugin-packagekit-refine.c
index 1a64738..a57dc49 100644
--- a/src/plugins/gs-plugin-packagekit-refine.c
+++ b/src/plugins/gs-plugin-packagekit-refine.c
@@ -643,6 +643,7 @@ gs_plugin_refine_require_details (GsPlugin *plugin,
 
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "packagekit-refine[source->license]");
+       g_assert (ptask != NULL);
        list_tmp = gs_app_list_new ();
        for (i = 0; i < gs_app_list_length (list); i++) {
                app = gs_app_list_index (list, i);
diff --git a/src/plugins/gs-plugin-packagekit.c b/src/plugins/gs-plugin-packagekit.c
index 2ca2e2f..7db657b 100644
--- a/src/plugins/gs-plugin-packagekit.c
+++ b/src/plugins/gs-plugin-packagekit.c
@@ -122,6 +122,7 @@ gs_plugin_add_sources_related (GsPlugin *plugin,
 
        ptask = as_profile_start_literal (gs_plugin_get_profile (plugin),
                                          "packagekit::add-sources-related");
+       g_assert (ptask != NULL);
        filter = pk_bitfield_from_enums (PK_FILTER_ENUM_INSTALLED,
                                         PK_FILTER_ENUM_NEWEST,
                                         PK_FILTER_ENUM_ARCH,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]