]> xenbits.xensource.com Git - libvirt.git/commitdiff
nodeinfo: Prefer MIN in nodeGetFreePages
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 23 Sep 2014 09:34:06 +0000 (11:34 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 23 Sep 2014 09:34:06 +0000 (11:34 +0200)
It's better to use a macro instead of if-else construct.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/nodeinfo.c

index 1b4a8d7d2f82d457d3ef6bdac55724f29d04c236..245992275d7909ffe5a5d674642e2e110795b27c 100644 (file)
@@ -2041,9 +2041,7 @@ nodeGetFreePages(unsigned int npages,
         goto cleanup;
     }
 
-    lastCell = startCell + cellCount;
-    if (startCell + cellCount < lastCell)
-        lastCell = startCell + cellCount;
+    lastCell = MIN(lastCell, startCell + cellCount);
 
     for (cell = startCell; cell < lastCell; cell++) {
         for (i = 0; i < npages; i++) {