aboutsummaryrefslogtreecommitdiff
path: root/gdb/utils.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-11-08 11:11:55 -0700
committerTom Tromey <tom@tromey.com>2017-01-10 19:13:46 -0700
commit6349f452e01ddb7a1e64b8a63c93a9c9abc95725 (patch)
tree90083421b411483f6dbf9c18ebe0906b3a00fbe4 /gdb/utils.h
parentc0171de646ddd85bac9d4bb1ebdf601f7ba7eeab (diff)
Introduce htab_up and use gdbpy_enter in py-framefilter.c
This introduces a new "htab_up" typedef, which is a std::unique_ptr that can call htab_delete. Then it changes some code in py-framefilter.c to use both gdbpy_enter and the new htab_up. 2017-01-10 Tom Tromey <tom@tromey.com> * utils.h (htab_deleter): New struct. (htab_up): New typedef. * python/py-framefilter.c (gdbpy_apply_frame_filter): Use gdbpy_enter, gdbpy_ref, htab_up.
Diffstat (limited to 'gdb/utils.h')
-rw-r--r--gdb/utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/gdb/utils.h b/gdb/utils.h
index 351814ea81..d7ae9cc81b 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -100,6 +100,18 @@ extern struct cleanup *make_cleanup_free_so (struct so_list *so);
extern struct cleanup *make_cleanup_restore_current_language (void);
+/* A deleter for a hash table. */
+struct htab_deleter
+{
+ void operator() (htab *ptr) const
+ {
+ htab_delete (ptr);
+ }
+};
+
+/* A unique_ptr wrapper for htab_t. */
+typedef std::unique_ptr<htab, htab_deleter> htab_up;
+
extern struct cleanup *make_cleanup_htab_delete (htab_t htab);
struct parser_state;