diff --git a/vlib/builtin/cfns_wrapper.c.v b/vlib/builtin/cfns_wrapper.c.v index b8d283f47f..7ab5793bd7 100644 --- a/vlib/builtin/cfns_wrapper.c.v +++ b/vlib/builtin/cfns_wrapper.c.v @@ -68,7 +68,9 @@ pub fn vmemset(s voidptr, c int, n int) voidptr { } type FnSortCB = fn (const_a voidptr, const_b voidptr) int + type FnSortContextCB = fn (const_a voidptr, const_b voidptr, context voidptr) int + fn C.vqsort_r(base voidptr, nel usize, width usize, cb FnSortContextCB, context voidptr) [inline; unsafe] diff --git a/vlib/builtin/sort_with_compare_context_test.v b/vlib/builtin/sort_with_compare_context_test.v index aede8470c5..76d40b5e81 100644 --- a/vlib/builtin/sort_with_compare_context_test.v +++ b/vlib/builtin/sort_with_compare_context_test.v @@ -29,14 +29,14 @@ fn test_sort_with_compare() { dump(a) dump(context) assert a == ['1', '3', '5', 'hi'] - + assert context.comparisons == [ 'a: "5" | b: "hi"', 'a: "hi" | b: "1"', 'a: "hi" | b: "3"', 'a: "3" | b: "5"', 'a: "5" | b: "1"', - 'a: "3" | b: "1"' + 'a: "3" | b: "1"', ] // mut already_sorted_context := Context{} @@ -48,6 +48,6 @@ fn test_sort_with_compare() { 'a: "5" | b: "1"', 'a: "5" | b: "3"', 'a: "5" | b: "hi"', - 'a: "1" | b: "3"' + 'a: "1" | b: "3"', ] }