[gnome-software: 10/25] gs-plugin-job-refine: Move pre-refine checks around




commit 9dd1ccd4c6714efc5599153afdb9a2ccc864a6c1
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Feb 23 16:31:50 2022 +0000

    gs-plugin-job-refine: Move pre-refine checks around
    
    A following commit will make `run_refine()` asynchronous. It’ll be
    easier to handle the branch for `self->flags != 0` if it’s inside
    `run_refine()` rather than providing an alternate code path which isn’t
    asynchronous.
    
    This introduces no functional changes.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Helps: #1658

 lib/gs-plugin-job-refine.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/lib/gs-plugin-job-refine.c b/lib/gs-plugin-job-refine.c
index 2d16db9e3..f99ffee31 100644
--- a/lib/gs-plugin-job-refine.c
+++ b/lib/gs-plugin-job-refine.c
@@ -366,6 +366,10 @@ run_refine (GsPluginJobRefine  *self,
        g_autoptr(GsAppList) freeze_list = NULL;
 
        /* nothing to do */
+       if (self->flags == 0) {
+               g_debug ("no refine flags set for transaction");
+               return TRUE;
+       }
        if (gs_app_list_length (list) == 0)
                return TRUE;
 
@@ -441,14 +445,10 @@ gs_plugin_job_refine_run_async (GsPluginJob         *job,
        result_list = gs_app_list_copy (self->app_list);
 
        /* run refine() on each one if required */
-       if (self->flags != 0) {
-               if (!run_refine (self, plugin_loader, result_list, cancellable, &local_error)) {
-                       gs_utils_error_convert_gio (&local_error);
-                       g_task_return_error (task, g_steal_pointer (&local_error));
-                       return;
-               }
-       } else {
-               g_debug ("no refine flags set for transaction");
+       if (!run_refine (self, plugin_loader, result_list, cancellable, &local_error)) {
+               gs_utils_error_convert_gio (&local_error);
+               g_task_return_error (task, g_steal_pointer (&local_error));
+               return;
        }
 
        /* Internal calls to #GsPluginJobRefine may want to do their own


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