Constify solib_name_from_address

I noticed that solib_name_from_address returned a non-const string,
but it's more appropriate to return const.  This patch implements
this.  Tested by rebuilding.
This commit is contained in:
Tom Tromey 2022-06-06 09:56:30 -06:00
parent b11f3dbb88
commit 6d08aed3c9
4 changed files with 6 additions and 6 deletions

View file

@ -351,7 +351,6 @@ pspy_get_objfiles (PyObject *self_, PyObject *args)
static PyObject *
pspy_solib_name (PyObject *o, PyObject *args)
{
char *soname;
gdb_py_ulongest pc;
pspace_object *self = (pspace_object *) o;
@ -360,7 +359,7 @@ pspy_solib_name (PyObject *o, PyObject *args)
if (!PyArg_ParseTuple (args, GDB_PY_LLU_ARG, &pc))
return NULL;
soname = solib_name_from_address (self->pspace, pc);
const char *soname = solib_name_from_address (self->pspace, pc);
if (soname == nullptr)
Py_RETURN_NONE;
return host_string_to_python_string (soname).release ();