diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-18 08:39:24 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2018-09-19 08:02:52 +0900 |
commit | 93bab288956f43c70f2b28a88efdc9effd951bb5 (patch) | |
tree | 453abf294f7bf2aba7ccf7ed37ccd669ec231c95 /src/nspawn/nspawn-mount.c | |
parent | 6058516a14ada1748313af6783f5b4e7e3006654 (diff) | |
download | systemd-93bab288956f43c70f2b28a88efdc9effd951bb5.tar.gz |
tree-wide: use typesafe_qsort()
Diffstat (limited to 'src/nspawn/nspawn-mount.c')
-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; |