render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
9119d9
From a9f728e94fbed7434c8286fc60dfcd1f980e3c6e Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <a9f728e94fbed7434c8286fc60dfcd1f980e3c6e@dist-git>
9119d9
From: Michal Privoznik <mprivozn@redhat.com>
9119d9
Date: Tue, 23 Sep 2014 11:54:35 +0200
9119d9
Subject: [PATCH] nodeinfo: Prefer MIN in nodeGetFreePages
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1145050
9119d9
9119d9
It's better to use a macro instead of if-else construct.
9119d9
9119d9
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
9119d9
(cherry picked from commit f8857c8f88ece3bb0790436e42751c2a09ae4453)
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/nodeinfo.c | 4 +---
9119d9
 1 file changed, 1 insertion(+), 3 deletions(-)
9119d9
9119d9
diff --git a/src/nodeinfo.c b/src/nodeinfo.c
9119d9
index 134fee7..80c723e 100644
9119d9
--- a/src/nodeinfo.c
9119d9
+++ b/src/nodeinfo.c
9119d9
@@ -2045,9 +2045,7 @@ nodeGetFreePages(unsigned int npages,
9119d9
         goto cleanup;
9119d9
     }
9119d9
 
9119d9
-    lastCell = startCell + cellCount;
9119d9
-    if (startCell + cellCount < lastCell)
9119d9
-        lastCell = startCell + cellCount;
9119d9
+    lastCell = MIN(lastCell, startCell + cellCount);
9119d9
 
9119d9
     for (cell = startCell; cell < lastCell; cell++) {
9119d9
         for (i = 0; i < npages; i++) {
9119d9
-- 
9119d9
2.1.1
9119d9