diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-11-27 08:29:20 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2020-11-27 14:35:20 +0900 |
commit | 95ca39f04efa278ac93881e6e364a6ae520b03e7 (patch) | |
tree | 8d1e188bcabaf41cccc7c732d99a5b3f029500e3 /src | |
parent | 751b4400631bcb4f43069ea75c85b61de13c2c29 (diff) | |
download | systemd-95ca39f04efa278ac93881e6e364a6ae520b03e7.tar.gz |
oom: use CMP() macro
Diffstat (limited to 'src')
-rw-r--r-- | src/oom/oomd-util.h | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/src/oom/oomd-util.h b/src/oom/oomd-util.h index 87ecda80fb..0834cbf09d 100644 --- a/src/oom/oomd-util.h +++ b/src/oom/oomd-util.h @@ -64,24 +64,14 @@ static inline int compare_pgscan(OomdCGroupContext * const *c1, OomdCGroupContex assert(c1); assert(c2); - if ((*c1)->pgscan > (*c2)->pgscan) - return -1; - else if ((*c1)->pgscan < (*c2)->pgscan) - return 1; - else - return 0; + return CMP((*c2)->pgscan, (*c1)->pgscan); } static inline int compare_swap_usage(OomdCGroupContext * const *c1, OomdCGroupContext * const *c2) { assert(c1); assert(c2); - if ((*c1)->swap_usage > (*c2)->swap_usage) - return -1; - else if ((*c1)->swap_usage < (*c2)->swap_usage) - return 1; - else - return 0; + return CMP((*c2)->swap_usage, (*c1)->swap_usage); } /* Get an array of OomdCGroupContexts from `h`, qsorted from largest to smallest values according to `compare_func`. |