public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: dwz@sourceware.org, jakub@redhat.com, mark@klomp.org
Subject: [committed] Use goto in dwz_files_1
Date: Sat, 27 Mar 2021 13:57:28 +0100	[thread overview]
Message-ID: <20210327125727.GA18369@delia> (raw)

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;

                 reply	other threads:[~2021-03-27 12:57 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210327125727.GA18369@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    --cc=mark@klomp.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).