mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-17 04:43:17 +08:00
Remove some cleanups from solib.c
This removes some cleanups from solib.c, replacing them with gdb::def_vector. Regression tested by the buildbot. gdb/ChangeLog 2018-03-18 Tom Tromey <tom@tromey.com> * solib.c (gdb_bfd_lookup_symbol_from_symtab): Use gdb::def_vector. (bfd_lookup_symbol_from_dyn_symtab): Likewise.
This commit is contained in:
10
gdb/solib.c
10
gdb/solib.c
@ -1474,8 +1474,8 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
asymbol **symbol_table = (asymbol **) xmalloc (storage_needed);
|
||||
struct cleanup *back_to = make_cleanup (xfree, symbol_table);
|
||||
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
|
||||
asymbol **symbol_table = storage.data ();
|
||||
unsigned int number_of_symbols =
|
||||
bfd_canonicalize_symtab (abfd, symbol_table);
|
||||
|
||||
@ -1510,7 +1510,6 @@ gdb_bfd_lookup_symbol_from_symtab (bfd *abfd,
|
||||
break;
|
||||
}
|
||||
}
|
||||
do_cleanups (back_to);
|
||||
}
|
||||
|
||||
return symaddr;
|
||||
@ -1533,8 +1532,8 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
|
||||
if (storage_needed > 0)
|
||||
{
|
||||
unsigned int i;
|
||||
asymbol **symbol_table = (asymbol **) xmalloc (storage_needed);
|
||||
struct cleanup *back_to = make_cleanup (xfree, symbol_table);
|
||||
gdb::def_vector<asymbol *> storage (storage_needed / sizeof (asymbol *));
|
||||
asymbol **symbol_table = storage.data ();
|
||||
unsigned int number_of_symbols =
|
||||
bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
|
||||
|
||||
@ -1549,7 +1548,6 @@ bfd_lookup_symbol_from_dyn_symtab (bfd *abfd,
|
||||
break;
|
||||
}
|
||||
}
|
||||
do_cleanups (back_to);
|
||||
}
|
||||
return symaddr;
|
||||
}
|
||||
|
Reference in New Issue
Block a user