aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r--gdb/objfiles.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index d261c87..e743834 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -160,7 +160,6 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd)
if (abfd != NULL)
storage->gdbarch = gdbarch_from_bfd (abfd);
- obstack_init (&storage->storage_obstack);
storage->filename_cache = bcache_xmalloc (NULL, NULL);
storage->macro_cache = bcache_xmalloc (NULL, NULL);
storage->language_of_main = language_unknown;
@@ -376,7 +375,7 @@ struct objfile *
allocate_objfile (bfd *abfd, const char *name, objfile_flags flags)
{
struct objfile *objfile;
- char *expanded_name;
+ const char *expanded_name;
objfile = XCNEW (struct objfile);
objfile->psymbol_cache = psymbol_bcache_init ();
@@ -386,22 +385,25 @@ allocate_objfile (bfd *abfd, const char *name, objfile_flags flags)
objfile_alloc_data (objfile);
+ gdb::unique_xmalloc_ptr<char> name_holder;
if (name == NULL)
{
gdb_assert (abfd == NULL);
gdb_assert ((flags & OBJF_NOT_FILENAME) != 0);
- expanded_name = xstrdup ("<<anonymous objfile>>");
+ expanded_name = "<<anonymous objfile>>";
}
else if ((flags & OBJF_NOT_FILENAME) != 0
|| is_target_filename (name))
- expanded_name = xstrdup (name);
+ expanded_name = name;
else
- expanded_name = gdb_abspath (name);
+ {
+ name_holder = gdb_abspath (name);
+ expanded_name = name_holder.get ();
+ }
objfile->original_name
= (char *) obstack_copy0 (&objfile->objfile_obstack,
expanded_name,
strlen (expanded_name));
- xfree (expanded_name);
/* Update the per-objfile information that comes from the bfd, ensuring
that any data that is reference is saved in the per-objfile data
@@ -1628,9 +1630,6 @@ objfile_flavour_name (struct objfile *objfile)
return NULL;
}
-/* Provide a prototype to silence -Wmissing-prototypes. */
-extern initialize_file_ftype _initialize_objfiles;
-
void
_initialize_objfiles (void)
{