[CRIU] [PATCH 13/20] compel handle_elf(): use continue

Kir Kolyshkin kir at openvz.org
Thu Dec 8 01:44:26 PST 2016


This is just to avoid a level of code block nesting/indentation
that can easily be avoided.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 compel/src/lib/handle-elf.c | 51 +++++++++++++++++++++++----------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c
index 3717371..2989103 100644
--- a/compel/src/lib/handle-elf.c
+++ b/compel/src/lib/handle-elf.c
@@ -233,35 +233,36 @@ int __handle_elf(void *mem, size_t size)
 		name = &symstrings[sym->st_name];
 		ptr_func_exit(name);
 
-		if (*name) {
-			pr_debug("\ttype 0x%-2x bind 0x%-2x shndx 0x%-4x value 0x%-2lx name %s\n",
-				 (unsigned)ELF_ST_TYPE(sym->st_info), (unsigned)ELF_ST_BIND(sym->st_info),
-				 (unsigned)sym->st_shndx, (unsigned long)sym->st_value, name);
+		if (!*name)
+			continue;
+
+		pr_debug("\ttype 0x%-2x bind 0x%-2x shndx 0x%-4x value 0x%-2lx name %s\n",
+				(unsigned)ELF_ST_TYPE(sym->st_info), (unsigned)ELF_ST_BIND(sym->st_info),
+				(unsigned)sym->st_shndx, (unsigned long)sym->st_value, name);
 #ifdef ELF_PPC64
-			if (!sym->st_value && !strncmp(name, ".TOC.", 6)) {
-				if (!toc_offset) {
-					pr_err("No TOC pointer\n");
-					goto err;
-				}
-				sym->st_value = toc_offset;
-				continue;
+		if (!sym->st_value && !strncmp(name, ".TOC.", 6)) {
+			if (!toc_offset) {
+				pr_err("No TOC pointer\n");
+				goto err;
 			}
+			sym->st_value = toc_offset;
+			continue;
+		}
 #endif
-			if (strncmp(name, "__export", 8))
-				continue;
-			if ((sym->st_shndx && sym->st_shndx < hdr->e_shnum) ||
-			    sym->st_shndx == SHN_ABS) {
-				if (sym->st_shndx == SHN_ABS) {
-					sh_src = NULL;
-				} else {
-					sh_src = sec_hdrs[sym->st_shndx];
-					ptr_func_exit(sh_src);
-				}
-				pr_out("#define %s_sym%s 0x%lx\n",
-				       opts.prefix, name,
-				       (unsigned long)(sym->st_value +
-						       (sh_src ? sh_src->sh_addr : 0)));
+		if (strncmp(name, "__export", 8))
+			continue;
+		if ((sym->st_shndx && sym->st_shndx < hdr->e_shnum) ||
+				sym->st_shndx == SHN_ABS) {
+			if (sym->st_shndx == SHN_ABS) {
+				sh_src = NULL;
+			} else {
+				sh_src = sec_hdrs[sym->st_shndx];
+				ptr_func_exit(sh_src);
 			}
+			pr_out("#define %s_sym%s 0x%lx\n",
+					opts.prefix, name,
+					(unsigned long)(sym->st_value +
+						(sh_src ? sh_src->sh_addr : 0)));
 		}
 	}
 
-- 
2.7.4



More information about the CRIU mailing list