mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: check array.sort_with_compare() arg mismatch (#11385)
This commit is contained in:
@ -146,11 +146,11 @@ pub fn (a array) repeat_to_depth(count int, depth int) array {
|
||||
}
|
||||
|
||||
// sort_with_compare sorts array in-place using given `compare` function as comparator.
|
||||
pub fn (mut a array) sort_with_compare(compare voidptr) {
|
||||
pub fn (mut a array) sort_with_compare(callback fn (voidptr, voidptr) int) {
|
||||
$if freestanding {
|
||||
panic('sort does not work with -freestanding')
|
||||
} $else {
|
||||
unsafe { vqsort(a.data, size_t(a.len), size_t(a.element_size), compare) }
|
||||
unsafe { vqsort(a.data, size_t(a.len), size_t(a.element_size), callback) }
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user