From aeb24f3081ad4971a82d90a9dac4cbe8da3bb228 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 14 May 2015 11:30:14 +0200 Subject: [PATCH] util: use GNU comparison function prototype for qsort_safe() --- src/shared/util.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/shared/util.h b/src/shared/util.h index 8565fd6e48f..637934fecc5 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);