[gnome-software/wip/hughsie/filesystem-random-ordering: 15/16] trivial: Fall back to ordering the plugins by name



commit afec9ec9c4c1d1e27972ebffe1a9efbbfd741c48
Author: Richard Hughes <richard hughsie com>
Date:   Thu Jul 12 13:52:17 2018 +0100

    trivial: Fall back to ordering the plugins by name
    
    If the ordering is important then they should have explicit dependencies set
    between plugins (e.g. GS_PLUGIN_RULE_RUN_AFTER) and we shouldn't rely on any
    kind of ordering from the filesystem as this is not defined by POSIX and may
    differ between XFS and EXT4.

 lib/gs-plugin-loader.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index de971461..3b3a0800 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -2290,13 +2290,13 @@ gs_plugin_loader_add_location (GsPluginLoader *plugin_loader, const gchar *locat
 static gint
 gs_plugin_loader_plugin_sort_fn (gconstpointer a, gconstpointer b)
 {
-       GsPlugin **pa = (GsPlugin **) a;
-       GsPlugin **pb = (GsPlugin **) b;
-       if (gs_plugin_get_order (*pa) < gs_plugin_get_order (*pb))
+       GsPlugin *pa = *((GsPlugin **) a);
+       GsPlugin *pb = *((GsPlugin **) b);
+       if (gs_plugin_get_order (pa) < gs_plugin_get_order (pb))
                return -1;
-       if (gs_plugin_get_order (*pa) > gs_plugin_get_order (*pb))
+       if (gs_plugin_get_order (pa) > gs_plugin_get_order (pb))
                return 1;
-       return 0;
+       return g_strcmp0 (gs_plugin_get_name (pa), gs_plugin_get_name (pb));
 }
 
 static void


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