mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 09:21:26 +03:00
basic/strv: use existing qsort_safe() helper
strv_sort() predates qsort_safe(), but we can convert it to it to save a few lines.
This commit is contained in:
parent
b1aa5ced45
commit
f6d703c395
@ -770,11 +770,7 @@ static int str_compare(const void *_a, const void *_b) {
|
||||
}
|
||||
|
||||
char **strv_sort(char **l) {
|
||||
|
||||
if (strv_isempty(l))
|
||||
return l;
|
||||
|
||||
qsort(l, strv_length(l), sizeof(char*), str_compare);
|
||||
qsort_safe(l, strv_length(l), sizeof(char*), str_compare);
|
||||
return l;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user