From 5d3a83d77dc3cfcc64a4d2a110c98cad5567d580 Mon Sep 17 00:00:00 2001 From: Srinivas Pandruvada Date: Fri, 16 Sep 2016 10:31:00 -0700 Subject: [PATCH] iio-buffer-utils: Really fix sorting of channels As per the documentation of g_ptr_array_sort "Note that the comparison function for g_ptr_array_sort() doesn't take the pointers from the array as arguments, it takes pointers to the pointers in the array" So the arguments to the function compare_channel_index (gconstpointer a, gconstpointer b) needs to be dereferenced to get pointer to iio_channel_info. The error was included in the fixup for commit 984803b by the maintainer. Closes #99 --- src/iio-buffer-utils.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/iio-buffer-utils.c b/src/iio-buffer-utils.c index 4087ea4..60a5dde 100644 --- a/src/iio-buffer-utils.c +++ b/src/iio-buffer-utils.c @@ -196,8 +196,8 @@ channel_info_free (iio_channel_info *ci) static int compare_channel_index (gconstpointer a, gconstpointer b) { - const iio_channel_info *info_1 = a; - const iio_channel_info *info_2 = b; + const iio_channel_info *info_1 = *(iio_channel_info **) a; + const iio_channel_info *info_2 = *(iio_channel_info **) b; return (int) (info_1->index - info_2->index); }