1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 00:51:24 +03:00

util: use GNU comparison function prototype for qsort_safe()

This commit is contained in:
Lennart Poettering 2015-05-14 11:30:14 +02:00
parent 7185d80558
commit aeb24f3081

View File

@ -779,12 +779,12 @@ int shall_restore_state(void);
* Normal qsort requires base to be nonnull. Here were require * Normal qsort requires base to be nonnull. Here were require
* that only if nmemb > 0. * that only if nmemb > 0.
*/ */
static inline void qsort_safe(void *base, size_t nmemb, size_t size, static inline void qsort_safe(void *base, size_t nmemb, size_t size, comparison_fn_t compar) {
int (*compar)(const void *, const void *)) { if (nmemb <= 0)
if (nmemb) { return;
assert(base);
qsort(base, nmemb, size, compar); assert(base);
} qsort(base, nmemb, size, compar);
} }
int proc_cmdline(char **ret); int proc_cmdline(char **ret);