summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-05-14 11:30:14 +0200
committerLennart Poettering <lennart@poettering.net>2015-05-14 11:32:41 +0200
commitaeb24f3081ad4971a82d90a9dac4cbe8da3bb228 (patch)
tree8221a6b281de385523fbe24cf30381bbaa14f0b0
parent7185d80558f7d85ddb67da0268a0f47138bf1401 (diff)
util: use GNU comparison function prototype for qsort_safe()
-rw-r--r--src/shared/util.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 8565fd6e48..637934fecc 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -779,12 +779,12 @@ int shall_restore_state(void);
* Normal qsort requires base to be nonnull. Here were require
* that only if nmemb > 0.
*/
-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);
- }
+static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) {
+ if (nmemb <= 0)
+ return;
+
+ assert(base);
+ qsort(base, nmemb, size, compar);
}
int proc_cmdline(char **ret);