[gnome-software/1744-software-remembers-past-install-intent: 37/39] gs-app-list: Remove unneeded code in gs_app_list_add_safe()




commit beab9564e8489d17b321afddc018534c297777ba
Author: Milan Crha <mcrha redhat com>
Date:   Tue May 17 14:27:10 2022 +0200

    gs-app-list: Remove unneeded code in gs_app_list_add_safe()
    
    While the call to `gs_app_get_unique_id()` can have side-effects,
    the function itself does the same thing regardless of the returned
    value from the `gs_app_get_unique_id()`, thus avoid that call.

 lib/gs-app-list.c | 10 ----------
 1 file changed, 10 deletions(-)
---
diff --git a/lib/gs-app-list.c b/lib/gs-app-list.c
index 961f2bb2a..1934699e5 100644
--- a/lib/gs-app-list.c
+++ b/lib/gs-app-list.c
@@ -424,21 +424,11 @@ typedef enum {
 static void
 gs_app_list_add_safe (GsAppList *list, GsApp *app, GsAppListAddFlag flag)
 {
-       const gchar *id;
-
        /* check for duplicate */
        if ((flag & GS_APP_LIST_ADD_FLAG_CHECK_FOR_DUPE) > 0 &&
            !gs_app_list_check_for_duplicate (list, app))
                return;
 
-       /* if we're lazy-loading the ID then we can't use the ID hash */
-       id = gs_app_get_unique_id (app);
-       if (id == NULL) {
-               gs_app_list_maybe_watch_app (list, app);
-               g_ptr_array_add (list->array, g_object_ref (app));
-               return;
-       }
-
        /* just use the ref */
        gs_app_list_maybe_watch_app (list, app);
        g_ptr_array_add (list->array, g_object_ref (app));


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