diff options
author | Tom Tromey <tom@tromey.com> | 2017-04-07 15:58:25 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-04-12 11:16:19 -0600 |
commit | 4c404b8be6b1d8759eed50366207fc0e2e47d2b1 (patch) | |
tree | 7ccde44e7fd5ecd0a0e87773aa39889eefd0941e | |
parent | 156d9eab863f40fc812245cf1213abbe12d192b3 (diff) | |
download | binutils-gdb-4c404b8be6b1d8759eed50366207fc0e2e47d2b1.tar.gz |
Use std::vector in reread_symbols
This changes reread_symbols to use std::vector, removing a cleanup.
gdb/ChangeLog
2017-04-12 Tom Tromey <tom@tromey.com>
* symfile.c (objfilep): Remove typedef.
(reread_symbols): Use a std::vector.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/symfile.c | 21 |
2 files changed, 10 insertions, 16 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 36514272a74..e7352729e84 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2017-04-12 Tom Tromey <tom@tromey.com> + * symfile.c (objfilep): Remove typedef. + (reread_symbols): Use a std::vector. + +2017-04-12 Tom Tromey <tom@tromey.com> + * mi/mi-main.c (exec_direction_forward): Remove. (exec_reverse_continue, mi_execute_command): Use scoped_restore. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Use diff --git a/gdb/symfile.c b/gdb/symfile.c index 7810f2c160b..846aabec481 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -2434,10 +2434,6 @@ remove_symbol_file_command (char *args, int from_tty) do_cleanups (my_cleanups); } -typedef struct objfile *objfilep; - -DEF_VEC_P (objfilep); - /* Re-read symbols if a symbol-file has changed. */ void @@ -2447,10 +2443,7 @@ reread_symbols (void) long new_modtime; struct stat new_statbuf; int res; - VEC (objfilep) *new_objfiles = NULL; - struct cleanup *all_cleanups; - - all_cleanups = make_cleanup (VEC_cleanup (objfilep), &new_objfiles); + std::vector<struct objfile *> new_objfiles; /* With the addition of shared libraries, this should be modified, the load time should be saved in the partial symbol tables, since @@ -2661,14 +2654,12 @@ reread_symbols (void) objfile->mtime = new_modtime; init_entry_point_info (objfile); - VEC_safe_push (objfilep, new_objfiles, objfile); + new_objfiles.push_back (objfile); } } - if (new_objfiles) + if (!new_objfiles.empty ()) { - int ix; - /* Notify objfiles that we've modified objfile sections. */ objfiles_changed (); @@ -2677,15 +2668,13 @@ reread_symbols (void) /* clear_objfile_data for each objfile was called before freeing it and observer_notify_new_objfile (NULL) has been called by clear_symtab_users above. Notify the new files now. */ - for (ix = 0; VEC_iterate (objfilep, new_objfiles, ix, objfile); ix++) - observer_notify_new_objfile (objfile); + for (auto iter : new_objfiles) + observer_notify_new_objfile (iter); /* At least one objfile has changed, so we can consider that the executable we're debugging has changed too. */ observer_notify_executable_changed (); } - - do_cleanups (all_cleanups); } |