aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2009-10-23 13:22:46 +0000
committerTristan Gingold <gingold@adacore.com>2009-10-23 13:22:46 +0000
commit2f6e5d7e9d6a416093702b75a536e8fed5c30d03 (patch)
tree0543c1240409b04d24f918f0555713b7dd47fd9f /gdb/objfiles.c
parent7fcab871034a5e755786062826456863ab65683b (diff)
downloadgdb-2f6e5d7e9d6a416093702b75a536e8fed5c30d03.zip
gdb-2f6e5d7e9d6a416093702b75a536e8fed5c30d03.tar.gz
gdb-2f6e5d7e9d6a416093702b75a536e8fed5c30d03.tar.bz2
2009-10-23 Tristan Gingold <gingold@adacore.com>
* objfiles.c (allocate_objfile): Remove useless test. Move declaration of last_one to the block that uses it.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 03a49a9..6082155 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -194,24 +194,16 @@ build_objfile_section_table (struct objfile *objfile)
struct objfile *
allocate_objfile (bfd *abfd, int flags)
{
- struct objfile *objfile = NULL;
- struct objfile *last_one = NULL;
+ struct objfile *objfile;
- /* If we don't support mapped symbol files, didn't ask for the file to be
- mapped, or failed to open the mapped file for some reason, then revert
- back to an unmapped objfile. */
-
- if (objfile == NULL)
- {
- objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
- memset (objfile, 0, sizeof (struct objfile));
- objfile->psymbol_cache = bcache_xmalloc ();
- objfile->macro_cache = bcache_xmalloc ();
- /* We could use obstack_specify_allocation here instead, but
- gdb_obstack.h specifies the alloc/dealloc functions. */
- obstack_init (&objfile->objfile_obstack);
- terminate_minimal_symbol_table (objfile);
- }
+ objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
+ memset (objfile, 0, sizeof (struct objfile));
+ objfile->psymbol_cache = bcache_xmalloc ();
+ objfile->macro_cache = bcache_xmalloc ();
+ /* We could use obstack_specify_allocation here instead, but
+ gdb_obstack.h specifies the alloc/dealloc functions. */
+ obstack_init (&objfile->objfile_obstack);
+ terminate_minimal_symbol_table (objfile);
objfile_alloc_data (objfile);
@@ -266,6 +258,8 @@ allocate_objfile (bfd *abfd, int flags)
object_files = objfile;
else
{
+ struct objfile *last_one;
+
for (last_one = object_files;
last_one->next;
last_one = last_one->next);