return 1;
}
-static void _pair_list_sort_split(fr_pair_t *source, fr_pair_list_t *front, fr_pair_list_t *back)
+static void _pair_list_sort_split(fr_pair_list_t *source, fr_pair_list_t *front, fr_pair_list_t *back)
{
fr_pair_t *fast;
fr_pair_t *slow;
/*
* Stopping condition - no more elements left to split
*/
- if (!source || !source->next) {
- *front = source;
+ if (!*source || !(*source)->next) {
+ *front = *source;
*back = NULL;
return;
* Fast advances twice as fast as slow, so when it gets to the end,
* slow will point to the middle of the linked list.
*/
- slow = source;
- fast = source->next;
+ slow = *source;
+ fast = (*source)->next;
while (fast) {
fast = fast->next;
}
}
- *front = source;
+ *front = *source;
*back = slow->next;
slow->next = NULL;
}
*/
if (!head || !head->next) return;
- _pair_list_sort_split(head, &a, &b); /* Split into sublists */
+ _pair_list_sort_split(&head, &a, &b); /* Split into sublists */
fr_pair_list_sort(&a, cmp); /* Traverse left */
fr_pair_list_sort(&b, cmp); /* Traverse right */