From: Lennart Poettering Date: Mon, 30 Nov 2020 15:23:15 +0000 (+0100) Subject: sort-util: make cmp_int() generic, so that we can reuse it elsewhere X-Git-Tag: v248-rc1~476^2~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1403d48d6189f71d450cf9cfda1ac8494e16b20c;p=thirdparty%2Fsystemd.git sort-util: make cmp_int() generic, so that we can reuse it elsewhere --- diff --git a/src/basic/fd-util.c b/src/basic/fd-util.c index 07a7b3a3063..a03ba83e19b 100644 --- a/src/basic/fd-util.c +++ b/src/basic/fd-util.c @@ -211,10 +211,6 @@ static int get_max_fd(void) { return (int) (m - 1); } -static int cmp_int(const int *a, const int *b) { - return CMP(*a, *b); -} - int close_all_fds(const int except[], size_t n_except) { static bool have_close_range = true; /* Assume we live in the future */ _cleanup_closedir_ DIR *d = NULL; diff --git a/src/basic/sort-util.c b/src/basic/sort-util.c index 92d7b8588d2..a9c68b7e3e3 100644 --- a/src/basic/sort-util.c +++ b/src/basic/sort-util.c @@ -27,3 +27,7 @@ void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, } return NULL; } + +int cmp_int(const int *a, const int *b) { + return CMP(*a, *b); +} diff --git a/src/basic/sort-util.h b/src/basic/sort-util.h index 1d194a1f049..49586a4a240 100644 --- a/src/basic/sort-util.h +++ b/src/basic/sort-util.h @@ -68,3 +68,5 @@ static inline void qsort_r_safe(void *base, size_t nmemb, size_t size, __compar_ int (*_func_)(const typeof(p[0])*, const typeof(p[0])*, typeof(userdata)) = func; \ qsort_r_safe((p), (n), sizeof((p)[0]), (__compar_d_fn_t) _func_, userdata); \ }) + +int cmp_int(const int *a, const int *b);