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
Subject: [committed] Simplify code now that split_dups no longer returns NULL
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200120155241.GA18613@delia> (raw)

Hi,

Now that split_dups no longer returns NULL, simplify the code in
partition_dups.

Committed to trunk.

Thanks,
- Tom

Simplify code now that split_dups no longer returns NULL

2020-01-20  Tom de Vries  <tdevries@suse.de>

	* dwz.c (partition_dups): Assume split_dups doesn't return NULL.

---
 dwz.c | 36 +++++-------------------------------
 1 file changed, 5 insertions(+), 31 deletions(-)

diff --git a/dwz.c b/dwz.c
index 08e3df4..c4f2aec 100644
--- a/dwz.c
+++ b/dwz.c
@@ -7079,55 +7079,29 @@ partition_dups (void)
     partition_find_dups (&ob2, cu->cu_die);
   vec_size = obstack_object_size (&ob2) / sizeof (void *);
 
-  size_t gap_start, gap_end;
   if (odr)
     {
-      size_t j;
-      gap_end = vec_size;
       arr = (dw_die_ref *) obstack_base (&ob2);
       if (progress_p)
 	{
 	  report_progress ();
 	  fprintf (stderr, "partition_dups split_dups\n");
 	}
-      for (i = 0; i < vec_size;)
+      for (i = 0; i < vec_size; i++)
 	{
 	  dw_die_ref die = arr[i];
 	  if (die_odr_state (NULL, die) == ODR_NONE)
-	    {
-	      i++;
-	      continue;
-	    }
+	    continue;
 	  die = split_dups (die, &ob2);
-	  if (die && unlikely (verify_dups_p))
+	  assert (die != NULL);
+	  if (unlikely (verify_dups_p))
 	    verify_dups (die, true);
 	  arr = (dw_die_ref *) obstack_base (&ob2);
-	  if (die == NULL)
-	    {
-	      arr[i] = arr[vec_size - 1];
-	      arr[vec_size - 1] = NULL;
-	      vec_size--;
-	    }
-	  else
-	    {
-	      arr[i] = die;
-	      ++i;
-	    }
+	  arr[i] = die;
 	}
-      gap_start = vec_size;
 
       vec_size = obstack_object_size (&ob2) / sizeof (void *);
 
-      if (gap_start != gap_end)
-	{
-	  for (i = gap_start, j = gap_end; j < vec_size; ++i, ++j)
-	    {
-	      arr[i] = arr[j];
-	      arr[j] = NULL;
-	    }
-	  vec_size = i;
-	}
-
       reset_die_ref_seen ();
       for (i = 0; i < vec_size; i++)
 	{

                 reply	other threads:[~2020-01-20 15:52 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=20200120155241.GA18613@delia \
    --to=tdevries@suse.de \
    --cc=dwz@sourceware.org \
    --cc=jakub@redhat.com \
    /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).