forked from Imagelibrary/binutils-gdb
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.
This commit is contained in:
12
gdb/utils.h
12
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;
|
||||
|
||||
Reference in New Issue
Block a user