summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2015-05-27 12:42:05 -0400
committerAnthony G. Basile <blueness@gentoo.org>2015-05-27 12:42:05 -0400
commit10647c881b4d2740a226cb954cf4b91c6e462907 (patch)
tree47a554083a170adc3a098919d1b64b9eb9c97e40 /src/shared/util.h
parentcf427188ad5e69e5de84461b4107697aa46f7e63 (diff)
src/shared/util.h: update qsort_safe() for musl
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 423210e2f0..e9178b9bd3 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -386,10 +386,11 @@ int unlink_noerrno(const char *path);
static inline void qsort_safe(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *)) {
- if (nmemb) {
- assert(base);
- qsort(base, nmemb, size, compar);
- }
+ if (nmemb <= 1)
+ return;
+
+ assert(base);
+ qsort(base, nmemb, size, compar);
}
int proc_cmdline(char **ret);