diff options
author | Richard Hughes <richard@hughsie.com> | 2012-02-22 09:28:39 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2012-02-22 09:28:39 +0000 |
commit | 15b89db2cdcdac71efa915492a81bfd4670002ae (patch) | |
tree | 6c7583539e3c8d74dcaf9c04aa56289bc47c91b4 | |
parent | 7ea61adc250de80f3b24ff0f448fc26f6d0fa74c (diff) |
zif: Ensure the files are sorted by name before returning them to the daemon
-rw-r--r-- | backends/zif/pk-backend-zif.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/backends/zif/pk-backend-zif.c b/backends/zif/pk-backend-zif.c index 4c464282..61163417 100644 --- a/backends/zif/pk-backend-zif.c +++ b/backends/zif/pk-backend-zif.c @@ -2748,6 +2748,15 @@ out: } /** + * pk_backend_sort_string_cb: + **/ +static gint +pk_backend_sort_string_cb (const gchar **a, const gchar **b) +{ + return g_strcmp0 (*a, *b); +} + +/** * pk_backend_get_files_thread: */ static gboolean @@ -2857,6 +2866,9 @@ pk_backend_get_files_thread (PkBackend *backend) goto out; } + /* sort these by name and add to list */ + g_ptr_array_sort (files, + (GCompareFunc) pk_backend_sort_string_cb); files_str = g_string_new (""); for (j=0; j<files->len; j++) { file = g_ptr_array_index (files, j); |