public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [committed] Use goto in dwz_files_1
@ 2021-03-27 12:57 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2021-03-27 12:57 UTC (permalink / raw)
  To: dwz, jakub, mark

Hi,

Use goto in dwz_files_1 to remove indentation, replacing:
...
  if (...)
    ret = 1;
  else
    {
      /* Lots of code.  */
    }
  /* Cleanup.  */
...
with:
...
  if (...)
    {
      ret = 1;
      goto cleanup;
    }

  /* Lots of code.  */

cleanup:
  /* Cleanup.  */
...

Committed to trunk.

Thanks,
- Tom

Use goto in dwz_files_1

2021-03-27  Tom de Vries  <tdevries@suse.de>

	* dwz.c (dwz_files_1): Reduce indentation.

---
 dwz.c | 50 +++++++++++++++++++++++++++-----------------------
 1 file changed, 27 insertions(+), 23 deletions(-)

diff --git a/dwz.c b/dwz.c
index f20a47d..3cc0a26 100644
--- a/dwz.c
+++ b/dwz.c
@@ -16603,32 +16603,36 @@ dwz_files_1 (int nr_files, char *files[], bool hardlink,
 
   dso = read_multifile (multi_fd, multifile_die_count);
   if (dso == NULL)
-    ret = 1;
-  else
     {
-      for (i = 0; i < nr_files; i++)
-	{
-	  dw_cu_ref cu;
-	  file = files[i];
-	  if (stats_p)
-	    init_stats (file);
-	  multifile_mode = MULTIFILE_MODE_FI;
-	  /* Don't process again files that couldn't
-	     be processed successfully.  Also skip hard links.  */
-	  if (resa[i].res == -1 || resa[i].res == -2
-	      || resa[i].skip_multifile)
-	    continue;
-	  for (cu = alt_first_cu; cu; cu = cu->cu_next)
-	    alt_clear_dups (cu->cu_die);
-	  ret |= dwz (file, NULL, &resa[i]);
-	}
-      if (hardlink)
-	update_hardlinks (nr_files, files, resa);
-      elf_end (dso->elf);
-      close (multi_fd);
-      free (dso);
+      ret = 1;
+      goto cleanup;
     }
 
+  for (i = 0; i < nr_files; i++)
+    {
+      dw_cu_ref cu;
+      file = files[i];
+      if (stats_p)
+	init_stats (file);
+      multifile_mode = MULTIFILE_MODE_FI;
+      /* Don't process again files that couldn't
+	 be processed successfully.  Also skip hard links.  */
+      if (resa[i].res == -1 || resa[i].res == -2
+	  || resa[i].skip_multifile)
+	continue;
+      for (cu = alt_first_cu; cu; cu = cu->cu_next)
+	alt_clear_dups (cu->cu_die);
+      ret |= dwz (file, NULL, &resa[i]);
+    }
+
+  if (hardlink)
+    update_hardlinks (nr_files, files, resa);
+
+  elf_end (dso->elf);
+  close (multi_fd);
+  free (dso);
+
+ cleanup:
   cleanup ();
 
   strp_htab = alt_strp_htab;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-27 12:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-27 12:57 [committed] Use goto in dwz_files_1 Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).