[gnome-software: 6/25] gs-odrs-provider: Move an early-return check




commit 0ae0904b63dd4a799e1e76be1733a9a2409da97c
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Feb 23 14:38:23 2022 +0000

    gs-odrs-provider: Move an early-return check
    
    This will simplify the code in an upcoming refactor commit to make
    `refine_app()` asynchronous.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1658

 lib/gs-odrs-provider.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/lib/gs-odrs-provider.c b/lib/gs-odrs-provider.c
index 18ab6886b..cb9e73da0 100644
--- a/lib/gs-odrs-provider.c
+++ b/lib/gs-odrs-provider.c
@@ -1348,6 +1348,13 @@ gs_odrs_provider_refine (GsOdrsProvider             *self,
        for (guint i = 0; i < gs_app_list_length (list); i++) {
                GsApp *app = gs_app_list_index (list, i);
                g_autoptr(GError) local_error = NULL;
+
+               /* not valid */
+               if (gs_app_get_kind (app) == AS_COMPONENT_KIND_ADDON)
+                       continue;
+               if (gs_app_get_id (app) == NULL)
+                       continue;
+
                if (!refine_app (self, app, flags, cancellable, &local_error)) {
                        if (g_error_matches (local_error, GS_ODRS_PROVIDER_ERROR, 
GS_ODRS_PROVIDER_ERROR_NO_NETWORK)) {
                                g_debug ("failed to refine app %s: %s",
@@ -1370,12 +1377,6 @@ refine_app (GsOdrsProvider             *self,
             GCancellable               *cancellable,
             GError                    **error)
 {
-       /* not valid */
-       if (gs_app_get_kind (app) == AS_COMPONENT_KIND_ADDON)
-               return TRUE;
-       if (gs_app_get_id (app) == NULL)
-               return TRUE;
-
        /* add reviews if possible */
        if ((flags & GS_ODRS_PROVIDER_REFINE_FLAGS_GET_REVIEWS) &&
            gs_app_get_reviews (app)->len == 0) {


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