Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

Commit

Permalink
iio-buffer-utils: Really fix sorting of channels
Browse files Browse the repository at this point in the history
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
  • Loading branch information
spandruvada authored and hadess committed Sep 16, 2016
1 parent cabe6ee commit 5d3a83d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/iio-buffer-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 5d3a83d

Please sign in to comment.