public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 9/9] Use htab_up in dwarf2/read.c
Date: Sat, 18 Jul 2020 11:29:15 -0600	[thread overview]
Message-ID: <20200718172915.6811-10-tom@tromey.com> (raw)
In-Reply-To: <20200718172915.6811-1-tom@tromey.com>

This changes dwarf2/read.c to use htab_up rather than explicit calls
to htab_delete.

gdb/ChangeLog
2020-07-18  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (compute_compunit_symtab_includes): Use htab_up.
---
 gdb/ChangeLog     |  4 ++++
 gdb/dwarf2/read.c | 20 +++++++++-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 39ed455def5..4a065974ec2 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -9818,23 +9818,24 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
     {
       int len;
       std::vector<compunit_symtab *> result_symtabs;
-      htab_t all_children, all_type_symtabs;
       compunit_symtab *cust = per_objfile->get_symtab (per_cu);
 
       /* If we don't have a symtab, we can just skip this case.  */
       if (cust == NULL)
 	return;
 
-      all_children = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
-					NULL, xcalloc, xfree);
-      all_type_symtabs = htab_create_alloc (1, htab_hash_pointer, htab_eq_pointer,
-					    NULL, xcalloc, xfree);
+      htab_up all_children (htab_create_alloc (1, htab_hash_pointer,
+					       htab_eq_pointer,
+					       NULL, xcalloc, xfree));
+      htab_up all_type_symtabs (htab_create_alloc (1, htab_hash_pointer,
+						   htab_eq_pointer,
+						   NULL, xcalloc, xfree));
 
       for (dwarf2_per_cu_data *ptr : *per_cu->imported_symtabs)
 	{
-	  recursively_compute_inclusions (&result_symtabs, all_children,
-					  all_type_symtabs, ptr, per_objfile,
-					  cust);
+	  recursively_compute_inclusions (&result_symtabs, all_children.get (),
+					  all_type_symtabs.get (), ptr,
+					  per_objfile, cust);
 	}
 
       /* Now we have a transitive closure of all the included symtabs.  */
@@ -9845,9 +9846,6 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu,
       memcpy (cust->includes, result_symtabs.data (),
 	      len * sizeof (compunit_symtab *));
       cust->includes[len] = NULL;
-
-      htab_delete (all_children);
-      htab_delete (all_type_symtabs);
     }
 }
 
-- 
2.17.2


  parent reply	other threads:[~2020-07-18 17:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-18 17:29 [PATCH 0/9] Use htab_up in more places Tom Tromey
2020-07-18 17:29 ` [PATCH 1/9] Use htab_up in auto-load.c Tom Tromey
2020-07-20  1:38   ` Simon Marchi
2020-09-17 17:48     ` Tom Tromey
2020-07-18 17:29 ` [PATCH 2/9] Use htab_up in breakpoint.c Tom Tromey
2020-07-18 17:29 ` [PATCH 3/9] Use htab_up in completion_tracker Tom Tromey
2020-07-18 17:29 ` [PATCH 4/9] Use htab_up in filename_seen_cache Tom Tromey
2020-07-20  1:41   ` Simon Marchi
2020-07-18 17:29 ` [PATCH 5/9] Use htab_up in linespec.c Tom Tromey
2020-07-20  1:47   ` Simon Marchi
2020-07-21  0:55     ` Tom Tromey
2020-07-18 17:29 ` [PATCH 6/9] Use htab_up in target-descriptions.c Tom Tromey
2020-07-18 17:29 ` [PATCH 7/9] Use htab_up in typedef_hash_table Tom Tromey
2020-07-18 17:29 ` [PATCH 8/9] Use htab_up in type copying Tom Tromey
2020-09-18 17:32   ` Andrew Burgess
2020-09-18 18:03     ` Tom Tromey
2020-09-18 18:20       ` Andrew Burgess
2020-07-18 17:29 ` Tom Tromey [this message]
2020-09-17 17:58 ` [PATCH 0/9] Use htab_up in more places Tom Tromey

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=20200718172915.6811-10-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.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).