gdb/python: Use copy-initialization more when possible

gdb/ChangeLog:
2018-08-24  Pedro Alves  <palves@redhat.com>

	* python/py-bpevent.c (create_breakpoint_event_object): Use
	copy-initialization.
	* python/py-continueevent.c (emit_continue_event): Use
	copy-initialization.
	* python/py-exitedevent.c (create_exited_event_object): Return a
	gdbpy_ref<>.
	(emit_exited_event): Use copy-initialization.
	* python/py-inferior.c (python_new_inferior)
	(python_inferior_deleted, add_thread_object): Use
	copy-initialization.
	* python/py-infevents.c (create_inferior_call_event_object)
	(create_register_changed_event_object)
	(create_memory_changed_event_object): Return a gdbpy_ref<>.
	(emit_inferior_call_event, emit_memory_changed_event)
	(emit_register_changed_event): Use copy-initialization.
	* python/py-newobjfileevent.c (create_new_objfile_event_object):
	Return a gdbpy_ref<>.
	(emit_new_objfile_event): Use copy-initialization.
	(create_clear_objfiles_event_object): Return a gdbpy_ref<>.
	(emit_clear_objfiles_event): Use copy-initialization.
	* python/py-signalevent.c (create_signal_event_object): Use
	copy-initialization.
	* python/py-threadevent.c (create_thread_event_object): Use
	copy-initialization.
This commit is contained in:
Pedro Alves 2018-08-24 20:09:19 +01:00
parent da3c873831
commit d98fc15be2
9 changed files with 61 additions and 39 deletions

View file

@ -256,7 +256,7 @@ python_new_inferior (struct inferior *inf)
return;
}
gdbpy_ref<> event (create_event_object (&new_inferior_event_object_type));
gdbpy_ref<> event = create_event_object (&new_inferior_event_object_type);
if (event == NULL
|| evpy_add_attribute (event.get (), "inferior",
(PyObject *) inf_obj.get ()) < 0
@ -284,7 +284,7 @@ python_inferior_deleted (struct inferior *inf)
return;
}
gdbpy_ref<> event (create_event_object (&inferior_deleted_event_object_type));
gdbpy_ref<> event = create_event_object (&inferior_deleted_event_object_type);
if (event == NULL
|| evpy_add_attribute (event.get (), "inferior",
(PyObject *) inf_obj.get ()) < 0
@ -353,8 +353,8 @@ add_thread_object (struct thread_info *tp)
if (evregpy_no_listeners_p (gdb_py_events.new_thread))
return;
gdbpy_ref<> event (create_thread_event_object (&new_thread_event_object_type,
(PyObject *) thread_obj));
gdbpy_ref<> event = create_thread_event_object (&new_thread_event_object_type,
(PyObject *) thread_obj);
if (event == NULL
|| evpy_emit_event (event.get (), gdb_py_events.new_thread) < 0)
gdbpy_print_stack ();