[CRIU] [PATCH] pstree: Use max() helper in max_pid assignment

Cyrill Gorcunov gorcunov at openvz.org
Mon Sep 17 08:58:58 EDT 2012


It shrinks code a bit.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pstree.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/pstree.c b/pstree.c
index aa88296..33f56e1 100644
--- a/pstree.c
+++ b/pstree.c
@@ -141,16 +141,13 @@ int prepare_pstree(void)
 			break;
 
 		pi->pid.virt = e->pid;
-		if (e->pid > max_pid)
-			max_pid = e->pid;
+		max_pid = max((int)e->pid, max_pid);
 
 		pi->pgid = e->pgid;
-		if (e->pgid > max_pid)
-			max_pid = e->pgid;
+		max_pid = max((int)e->pgid, max_pid);
 
 		pi->sid = e->sid;
-		if (e->sid > max_pid)
-			max_pid = e->sid;
+		max_pid = max((int)e->sid, max_pid);
 
 		if (e->ppid == 0) {
 			BUG_ON(root_item);
-- 
1.7.7.6



More information about the CRIU mailing list