]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sort-util: make cmp_int() generic, so that we can reuse it elsewhere
authorLennart Poettering <lennart@poettering.net>
Mon, 30 Nov 2020 15:23:15 +0000 (16:23 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 17 Dec 2020 19:01:02 +0000 (20:01 +0100)
src/basic/fd-util.c
src/basic/sort-util.c
src/basic/sort-util.h

index 07a7b3a30639fb6cc057b9ba42c98e1459f4d537..a03ba83e19b1f19842c1a07cfbd869decf7a9332 100644 (file)
@@ -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;
index 92d7b8588d20944eabefcb8b474af39b69514b09..a9c68b7e3e394e4011827f0d99da39c3dcfd1645 100644 (file)
@@ -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);
+}
index 1d194a1f04992504e78bf4b355bc56634652dbbf..49586a4a24073f5599aa0ba28dd67d8b6b8a1518 100644 (file)
@@ -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);