teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame 95ca39f04efa278ac93881e6e364a6ae520b03e7.patch

834f04
From 95ca39f04efa278ac93881e6e364a6ae520b03e7 Mon Sep 17 00:00:00 2001
834f04
From: Yu Watanabe <watanabe.yu+github@gmail.com>
834f04
Date: Fri, 27 Nov 2020 08:29:20 +0900
834f04
Subject: [PATCH] oom: use CMP() macro
834f04
834f04
---
834f04
 src/oom/oomd-util.h | 14 ++------------
834f04
 1 file changed, 2 insertions(+), 12 deletions(-)
834f04
834f04
diff --git a/src/oom/oomd-util.h b/src/oom/oomd-util.h
834f04
index 87ecda80fbc..0834cbf09d7 100644
834f04
--- a/src/oom/oomd-util.h
834f04
+++ b/src/oom/oomd-util.h
834f04
@@ -64,24 +64,14 @@ static inline int compare_pgscan(OomdCGroupContext * const *c1, OomdCGroupContex
834f04
         assert(c1);
834f04
         assert(c2);
834f04
 
834f04
-        if ((*c1)->pgscan > (*c2)->pgscan)
834f04
-                return -1;
834f04
-        else if ((*c1)->pgscan < (*c2)->pgscan)
834f04
-                return 1;
834f04
-        else
834f04
-                return 0;
834f04
+        return CMP((*c2)->pgscan, (*c1)->pgscan);
834f04
 }
834f04
 
834f04
 static inline int compare_swap_usage(OomdCGroupContext * const *c1, OomdCGroupContext * const *c2) {
834f04
         assert(c1);
834f04
         assert(c2);
834f04
 
834f04
-        if ((*c1)->swap_usage > (*c2)->swap_usage)
834f04
-                return -1;
834f04
-        else if ((*c1)->swap_usage < (*c2)->swap_usage)
834f04
-                return 1;
834f04
-        else
834f04
-                return 0;
834f04
+        return CMP((*c2)->swap_usage, (*c1)->swap_usage);
834f04
 }
834f04
 
834f04
 /* Get an array of OomdCGroupContexts from `h`, qsorted from largest to smallest values according to `compare_func`.