diff options
author | Pedro Alves <palves@redhat.com> | 2018-08-24 20:09:19 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2018-08-24 22:57:16 +0100 |
commit | d98fc15be2b8dd5699c1852db7d9d979231123dc (patch) | |
tree | b90de293d215ac05883021a5ac2da87d63136cb2 /gdb/python/py-infevents.c | |
parent | da3c873831707454d45cee6705075b27a1732f09 (diff) | |
download | gdb-d98fc15be2b8dd5699c1852db7d9d979231123dc.zip gdb-d98fc15be2b8dd5699c1852db7d9d979231123dc.tar.gz gdb-d98fc15be2b8dd5699c1852db7d9d979231123dc.tar.bz2 |
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.
Diffstat (limited to 'gdb/python/py-infevents.c')
-rw-r--r-- | gdb/python/py-infevents.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gdb/python/py-infevents.c b/gdb/python/py-infevents.c index 2bd0bc7..0df7d96 100644 --- a/gdb/python/py-infevents.c +++ b/gdb/python/py-infevents.c @@ -24,7 +24,7 @@ /* Construct either a gdb.InferiorCallPreEvent or a gdb.InferiorCallPostEvent. */ -static PyObject * +static gdbpy_ref<> create_inferior_call_event_object (inferior_call_kind flag, ptid_t ptid, CORE_ADDR addr) { @@ -56,17 +56,17 @@ create_inferior_call_event_object (inferior_call_kind flag, ptid_t ptid, if (evpy_add_attribute (event.get (), "address", addr_obj.get ()) < 0) return NULL; - return event.release (); + return event; } /* Construct a gdb.RegisterChangedEvent containing the affected register number. */ -static PyObject * +static gdbpy_ref<> create_register_changed_event_object (struct frame_info *frame, int regnum) { - gdbpy_ref<> event (create_event_object (®ister_changed_event_object_type)); + gdbpy_ref<> event = create_event_object (®ister_changed_event_object_type); if (event == NULL) return NULL; @@ -84,16 +84,16 @@ create_register_changed_event_object (struct frame_info *frame, if (evpy_add_attribute (event.get (), "regnum", regnum_obj.get ()) < 0) return NULL; - return event.release (); + return event; } /* Construct a gdb.MemoryChangedEvent describing the extent of the affected memory. */ -static PyObject * +static gdbpy_ref<> create_memory_changed_event_object (CORE_ADDR addr, ssize_t len) { - gdbpy_ref<> event (create_event_object (&memory_changed_event_object_type)); + gdbpy_ref<> event = create_event_object (&memory_changed_event_object_type); if (event == NULL) return NULL; @@ -112,7 +112,7 @@ create_memory_changed_event_object (CORE_ADDR addr, ssize_t len) if (evpy_add_attribute (event.get (), "length", len_obj.get ()) < 0) return NULL; - return event.release (); + return event; } /* Callback function which notifies observers when an event occurs which @@ -127,7 +127,7 @@ emit_inferior_call_event (inferior_call_kind flag, ptid_t thread, if (evregpy_no_listeners_p (gdb_py_events.inferior_call)) return 0; - gdbpy_ref<> event (create_inferior_call_event_object (flag, thread, addr)); + gdbpy_ref<> event = create_inferior_call_event_object (flag, thread, addr); if (event != NULL) return evpy_emit_event (event.get (), gdb_py_events.inferior_call); return -1; @@ -142,7 +142,7 @@ emit_memory_changed_event (CORE_ADDR addr, ssize_t len) if (evregpy_no_listeners_p (gdb_py_events.memory_changed)) return 0; - gdbpy_ref<> event (create_memory_changed_event_object (addr, len)); + gdbpy_ref<> event = create_memory_changed_event_object (addr, len); if (event != NULL) return evpy_emit_event (event.get (), gdb_py_events.memory_changed); return -1; @@ -157,7 +157,7 @@ emit_register_changed_event (struct frame_info* frame, int regnum) if (evregpy_no_listeners_p (gdb_py_events.register_changed)) return 0; - gdbpy_ref<> event (create_register_changed_event_object (frame, regnum)); + gdbpy_ref<> event = create_register_changed_event_object (frame, regnum); if (event != NULL) return evpy_emit_event (event.get (), gdb_py_events.register_changed); return -1; |