mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-05-23 18:26:47 +08:00
Use gdbpy_ref to simplify some logic
This uses the new gdbpy_ref template to simplify logic in various parts of the Python layer; for example removing repeated error code or removing gotos. gdb/ChangeLog 2017-02-10 Tom Tromey <tom@tromey.com> * python/py-cmd.c (cmdpy_destroyer): Use gdbpy_ref. * python/py-breakpoint.c (gdbpy_breakpoint_deleted): Use gdbpy_ref. * python/py-type.c (field_new): Use gdbpy_ref. * python/py-symtab.c (symtab_and_line_to_sal_object): Use gdbpy_ref. * python/py-progspace.c (pspy_new): Use gdbpy_ref. (py_free_pspace): Likewise. (pspace_to_pspace_object): Likewise. * python/py-objfile.c (objfpy_new): Use gdbpy_ref. (py_free_objfile): Likewise. (objfile_to_objfile_object): Likewise. * python/py-inferior.c (delete_thread_object): Use gdbpy_ref. (infpy_read_memory): Likewise. (py_free_inferior): Likewise. * python/py-evtregistry.c (create_eventregistry_object): Use gdbpy_ref. * python/py-event.c (create_event_object): Use gdbpy_ref.
This commit is contained in:
@ -95,14 +95,11 @@ cmdpy_dont_repeat (PyObject *self, PyObject *args)
|
||||
static void
|
||||
cmdpy_destroyer (struct cmd_list_element *self, void *context)
|
||||
{
|
||||
cmdpy_object *cmd;
|
||||
|
||||
gdbpy_enter enter_py (get_current_arch (), current_language);
|
||||
|
||||
/* Release our hold on the command object. */
|
||||
cmd = (cmdpy_object *) context;
|
||||
gdbpy_ref<cmdpy_object> cmd ((cmdpy_object *) context);
|
||||
cmd->command = NULL;
|
||||
Py_DECREF (cmd);
|
||||
|
||||
/* We allocated the name, doc string, and perhaps the prefix
|
||||
name. */
|
||||
|
Reference in New Issue
Block a user