Change objfile_to_objfile_object to return a new reference

This changes objfile_to_objfile_object to return a new references and
fixes up all the uses.

gdb/ChangeLog
2018-09-16  Tom Tromey  <tom@tromey.com>

	* python/py-progspace.c (pspy_get_objfiles): Update.
	* python/python-internal.h (objfile_to_objfile_object): Change
	return type.
	* python/py-newobjfileevent.c (create_new_objfile_event_object):
	Update.
	* python/py-xmethods.c (gdbpy_get_matching_xmethod_workers):
	Update.
	* python/python.c (gdbpy_get_current_objfile): Update.
	(gdbpy_objfiles): Update.
	* python/py-objfile.c (objfpy_get_owner, gdbpy_lookup_objfile):
	Update.
	(objfile_to_objfile_object): Return a new reference.
	* python/py-symtab.c (stpy_get_objfile): Update.
	* python/py-prettyprint.c (find_pretty_printer_from_objfiles):
	Update.
This commit is contained in:
Tom Tromey 2018-09-12 23:06:09 -06:00
parent 3c7aa30778
commit 0a9db5ad8a
9 changed files with 51 additions and 51 deletions

View file

@ -28,12 +28,10 @@ create_new_objfile_event_object (struct objfile *objfile)
if (objfile_event == NULL)
return NULL;
/* Note that objfile_to_objfile_object returns a borrowed reference,
so we don't need a decref here. */
PyObject *py_objfile = objfile_to_objfile_object (objfile);
if (!py_objfile || evpy_add_attribute (objfile_event.get (),
"new_objfile",
py_objfile) < 0)
gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
if (py_objfile == NULL || evpy_add_attribute (objfile_event.get (),
"new_objfile",
py_objfile.get ()) < 0)
return NULL;
return objfile_event;