systemd/95ca39f04efa278ac93881e6e364a6ae520b03e7.patch
DistroBaker 2a38ee711e Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/systemd.git#0257583091a9b13d4ca7012ee3632f67af009b85
2021-02-16 18:25:28 +00:00

41 lines
1.3 KiB
Diff

From 95ca39f04efa278ac93881e6e364a6ae520b03e7 Mon Sep 17 00:00:00 2001
From: Yu Watanabe <watanabe.yu+github@gmail.com>
Date: Fri, 27 Nov 2020 08:29:20 +0900
Subject: [PATCH] oom: use CMP() macro
---
src/oom/oomd-util.h | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/src/oom/oomd-util.h b/src/oom/oomd-util.h
index 87ecda80fbc..0834cbf09d7 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`.