diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-18 01:39:24 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-19 01:02:52 +0200 |
commit | 93bab288956f43c70f2b28a88efdc9effd951bb5 (patch) | |
tree | 453abf294f7bf2aba7ccf7ed37ccd669ec231c95 /src/nspawn | |
parent | detect-virt: do not try to read all of /proc/cpuinfo (diff) | |
download | systemd-93bab288956f43c70f2b28a88efdc9effd951bb5.tar.xz systemd-93bab288956f43c70f2b28a88efdc9effd951bb5.zip |
tree-wide: use typesafe_qsort()
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn-mount.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c index 995022272a..5bef6aef59 100644 --- a/src/nspawn/nspawn-mount.c +++ b/src/nspawn/nspawn-mount.c @@ -69,20 +69,14 @@ void custom_mount_free_all(CustomMount *l, size_t n) { free(l); } -static int custom_mount_compare(const void *a, const void *b) { - const CustomMount *x = a, *y = b; +static int custom_mount_compare(const CustomMount *a, const CustomMount *b) { int r; - r = path_compare(x->destination, y->destination); + r = path_compare(a->destination, b->destination); if (r != 0) return r; - if (x->type < y->type) - return -1; - if (x->type > y->type) - return 1; - - return 0; + return CMP(a->type, b->type); } static bool source_path_is_valid(const char *p) { @@ -116,7 +110,7 @@ int custom_mount_prepare_all(const char *dest, CustomMount *l, size_t n) { assert(l || n == 0); /* Order the custom mounts, and make sure we have a working directory */ - qsort_safe(l, n, sizeof(CustomMount), custom_mount_compare); + typesafe_qsort(l, n, custom_mount_compare); for (i = 0; i < n; i++) { CustomMount *m = l + i; |