summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);