[CRIU] [PATCH 7/7] files: Rename variables in collect_fd

Cyrill Gorcunov gorcunov at openvz.org
Thu Aug 23 04:48:16 EDT 2012


Variables `l' and `le' are short and named
too similar which makes them hard to distinguish.

Thus rename `l' to `le' (list entry) and `le' to
`new_le'. This makes them easy to recognize.

Also add braces around list_for_each_entry.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 files.c |   27 ++++++++++++++-------------
 1 files changed, 14 insertions(+), 13 deletions(-)

diff --git a/files.c b/files.c
index 4cf6f1a..8931b7b 100644
--- a/files.c
+++ b/files.c
@@ -149,19 +149,19 @@ int rst_file_params(int fd, FownEntry *fown, int flags)
 
 static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
 {
-	struct fdinfo_list_entry *l, *le;
+	struct fdinfo_list_entry *le, *new_le;
 	struct file_desc *fdesc;
 
 	pr_info("Collect fdinfo pid=%d fd=%d id=0x%16x\n",
 		pid, e->fd, e->id);
 
-	le = shmalloc(sizeof(*le));
-	if (!le)
+	new_le = shmalloc(sizeof(*new_le));
+	if (!new_le)
 		return -1;
 
-	le->pid = pid;
-	futex_init(&le->wait_id);
-	le->fe = e;
+	futex_init(&new_le->wait_id);
+	new_le->pid = pid;
+	new_le->fe = e;
 
 	fdesc = find_file_desc(e);
 	if (fdesc == NULL) {
@@ -169,17 +169,18 @@ static int collect_fd(int pid, FdinfoEntry *e, struct rst_info *rst_info)
 		return -1;
 	}
 
-	list_for_each_entry(l, &fdesc->fd_info_head, desc_list)
-		if (l->pid > le->pid)
+	list_for_each_entry(le, &fdesc->fd_info_head, desc_list) {
+		if (le->pid > new_le->pid)
 			break;
+	}
 
-	list_add_tail(&le->desc_list, &l->desc_list);
-	le->desc = fdesc;
+	list_add_tail(&new_le->desc_list, &le->desc_list);
+	new_le->desc = fdesc;
 
-	if (unlikely(le->fe->type == FD_TYPES__EVENTPOLL))
-		list_add_tail(&le->ps_list, &rst_info->eventpoll);
+	if (unlikely(new_le->fe->type == FD_TYPES__EVENTPOLL))
+		list_add_tail(&new_le->ps_list, &rst_info->eventpoll);
 	else
-		list_add_tail(&le->ps_list, &rst_info->fds);
+		list_add_tail(&new_le->ps_list, &rst_info->fds);
 	return 0;
 }
 
-- 
1.7.7.6



More information about the CRIU mailing list