forked from Imagelibrary/binutils-gdb
gdb/
Code cleanup. * objfiles.c (allocate_objfile) <objfile->name != NULL>: Remove. (free_objfile) <objfile->name != NULL>: Remove the conditional around xfree. * objfiles.h (struct objfile) <name>: New comment it is never NULL. * python/py-auto-load.c (auto_load_new_objfile) <!objfile->name>: Remove. * python/py-objfile.c (objfpy_get_filename) <obj->objfile->name> Remove the conditional. * python/py-progspace.c (pspy_get_filename) <objfile->name>: Likewise.
This commit is contained in:
@@ -1,3 +1,16 @@
|
|||||||
|
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Code cleanup.
|
||||||
|
* objfiles.c (allocate_objfile) <objfile->name != NULL>: Remove.
|
||||||
|
(free_objfile) <objfile->name != NULL>: Remove the conditional around
|
||||||
|
xfree.
|
||||||
|
* objfiles.h (struct objfile) <name>: New comment it is never NULL.
|
||||||
|
* python/py-auto-load.c (auto_load_new_objfile) <!objfile->name>:
|
||||||
|
Remove.
|
||||||
|
* python/py-objfile.c (objfpy_get_filename) <obj->objfile->name>
|
||||||
|
Remove the conditional.
|
||||||
|
* python/py-progspace.c (pspy_get_filename) <objfile->name>: Likewise.
|
||||||
|
|
||||||
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2010-09-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
* main.c: Include objfiles.h.
|
* main.c: Include objfiles.h.
|
||||||
|
|||||||
@@ -214,10 +214,6 @@ allocate_objfile (bfd *abfd, int flags)
|
|||||||
region. */
|
region. */
|
||||||
|
|
||||||
objfile->obfd = gdb_bfd_ref (abfd);
|
objfile->obfd = gdb_bfd_ref (abfd);
|
||||||
if (objfile->name != NULL)
|
|
||||||
{
|
|
||||||
xfree (objfile->name);
|
|
||||||
}
|
|
||||||
if (abfd != NULL)
|
if (abfd != NULL)
|
||||||
{
|
{
|
||||||
/* Look up the gdbarch associated with the BFD. */
|
/* Look up the gdbarch associated with the BFD. */
|
||||||
@@ -649,10 +645,7 @@ free_objfile (struct objfile *objfile)
|
|||||||
|
|
||||||
/* The last thing we do is free the objfile struct itself. */
|
/* The last thing we do is free the objfile struct itself. */
|
||||||
|
|
||||||
if (objfile->name != NULL)
|
xfree (objfile->name);
|
||||||
{
|
|
||||||
xfree (objfile->name);
|
|
||||||
}
|
|
||||||
if (objfile->global_psymbols.list)
|
if (objfile->global_psymbols.list)
|
||||||
xfree (objfile->global_psymbols.list);
|
xfree (objfile->global_psymbols.list);
|
||||||
if (objfile->static_psymbols.list)
|
if (objfile->static_psymbols.list)
|
||||||
|
|||||||
@@ -188,8 +188,8 @@ struct objfile
|
|||||||
|
|
||||||
struct objfile *next;
|
struct objfile *next;
|
||||||
|
|
||||||
/* The object file's name, tilde-expanded and absolute.
|
/* The object file's name, tilde-expanded and absolute. Malloc'd; free it
|
||||||
Malloc'd; free it if you free this struct. */
|
if you free this struct. This pointer is never NULL. */
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
|
|||||||
@@ -395,8 +395,6 @@ auto_load_new_objfile (struct objfile *objfile)
|
|||||||
clear_section_scripts ();
|
clear_section_scripts ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!objfile->name)
|
|
||||||
return;
|
|
||||||
|
|
||||||
load_auto_scripts_for_objfile (objfile);
|
load_auto_scripts_for_objfile (objfile);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ objfpy_get_filename (PyObject *self, void *closure)
|
|||||||
{
|
{
|
||||||
objfile_object *obj = (objfile_object *) self;
|
objfile_object *obj = (objfile_object *) self;
|
||||||
|
|
||||||
if (obj->objfile && obj->objfile->name)
|
if (obj->objfile)
|
||||||
return PyString_Decode (obj->objfile->name, strlen (obj->objfile->name),
|
return PyString_Decode (obj->objfile->name, strlen (obj->objfile->name),
|
||||||
host_charset (), NULL);
|
host_charset (), NULL);
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ pspy_get_filename (PyObject *self, void *closure)
|
|||||||
{
|
{
|
||||||
struct objfile *objfile = obj->pspace->symfile_object_file;
|
struct objfile *objfile = obj->pspace->symfile_object_file;
|
||||||
|
|
||||||
if (objfile && objfile->name)
|
if (objfile)
|
||||||
return PyString_Decode (objfile->name, strlen (objfile->name),
|
return PyString_Decode (objfile->name, strlen (objfile->name),
|
||||||
host_charset (), NULL);
|
host_charset (), NULL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user