chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0fc8360
)
basic/strv: use existing qsort_safe() helper
author
Zbigniew Jędrzejewski-Szmek
<zbyszek@in.waw.pl>
Mon, 10 Jul 2017 18:55:14 +0000
(14:55 -0400)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 25 Jul 2017 07:48:11 +0000
(09:48 +0200)
strv_sort() predates qsort_safe(), but we can convert it to it to
save a few lines.
src/basic/strv.c
patch
|
blob
|
history
diff --git
a/src/basic/strv.c
b/src/basic/strv.c
index c2defbe970149cc8a0423f70362e44ce4f691d68..f0c764b17ae16dc74cd53a485d8dcf78f21bc57c 100644
(file)
--- a/
src/basic/strv.c
+++ b/
src/basic/strv.c
@@
-782,11
+782,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;
}