diff options
author | Kalev Lember <klember@redhat.com> | 2016-05-26 10:19:17 +0200 |
---|---|---|
committer | Kalev Lember <klember@redhat.com> | 2016-05-26 10:19:17 +0200 |
commit | dc433c89b8b5fb96998c3366875fabd690bbf4ee (patch) | |
tree | ebe16dfdca69cb852abd249a45b0a2dd2ca888e2 | |
parent | b8bf861c684d73b15dd368f628fc8218918cea76 (diff) | |
download | appstream-glib-wip/kalev/my_pstrcmp.tar.gz |
Fix g_ptr_array_sort usewip/kalev/my_pstrcmp
We can't directly use g_strcmp0 as the comparison function as
g_ptr_array_sort comparison function takes pointers to the pointers in
the array.
-rw-r--r-- | libappstream-builder/asb-utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libappstream-builder/asb-utils.c b/libappstream-builder/asb-utils.c index f37d09a..284d301 100644 --- a/libappstream-builder/asb-utils.c +++ b/libappstream-builder/asb-utils.c @@ -508,6 +508,12 @@ asb_utils_add_files_recursive (GPtrArray *files, return TRUE; } +static gint +my_pstrcmp (const gchar **a, const gchar **b) +{ + return g_strcmp0 (*a, *b); +} + /** * asb_utils_write_archive_dir: * @filename: archive filename @@ -535,7 +541,7 @@ asb_utils_write_archive_dir (const gchar *filename, return TRUE; /* sort by filename for deterministic results */ - g_ptr_array_sort (files, g_strcmp0); + g_ptr_array_sort (files, (GCompareFunc) my_pstrcmp); /* write tar file */ return asb_utils_write_archive (filename, directory, files, error); |