diff options
author | Tom Tromey <tom@tromey.com> | 2020-12-11 09:33:36 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-12-11 09:33:37 -0700 |
commit | d8f168ddd08f1d5fde1a193724cdc40d524039a7 (patch) | |
tree | 5f6679f48c8d8d0d2c0e4ae44bf61f2d0a7c9e32 /gdb/varobj.c | |
parent | 76deb5d9181416cb7ea68764db13e7059d48a46c (diff) | |
download | gdb-d8f168ddd08f1d5fde1a193724cdc40d524039a7.zip gdb-d8f168ddd08f1d5fde1a193724cdc40d524039a7.tar.gz gdb-d8f168ddd08f1d5fde1a193724cdc40d524039a7.tar.bz2 |
Change all_root_varobjs to take a function_view
This changes all_root_varobjs to take a function_view. This
simplifies some of the callers, in particular we can remove a data
type that only existed to be passed through.
gdb/ChangeLog
2020-12-11 Tom Tromey <tom@tromey.com>
* varobj.h (all_root_varobjs): Take a function_view.
* varobj.c (all_root_varobjs): Take a function_view.
(varobj_invalidate_iter): Remove unused parameter.
(varobj_invalidate): Update.
* mi/mi-cmd-var.c (struct mi_cmd_var_update): Remove.
(mi_cmd_var_update_iter): Change parameters.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r-- | gdb/varobj.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c index 7124e25..e4d640f 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2357,11 +2357,11 @@ varobj_default_value_is_changeable_p (const struct varobj *var) return r; } -/* Iterate all the existing _root_ VAROBJs and call the FUNC callback for them - with an arbitrary caller supplied DATA pointer. */ +/* Iterate all the existing _root_ VAROBJs and call the FUNC callback + for each one. */ void -all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) +all_root_varobjs (gdb::function_view<void (struct varobj *var)> func) { /* Iterate "safely" - handle if the callee deletes its passed VAROBJ. */ auto iter = rootlist.begin (); @@ -2369,7 +2369,7 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) while (iter != end) { auto self = iter++; - (*func) ((*self)->rootvar, data); + func ((*self)->rootvar); } } @@ -2381,7 +2381,7 @@ all_root_varobjs (void (*func) (struct varobj *var, void *data), void *data) varobj must be either re-evaluated, or marked as invalid here. */ static void -varobj_invalidate_iter (struct varobj *var, void *unused) +varobj_invalidate_iter (struct varobj *var) { /* global and floating var must be re-evaluated. */ if (var->root->floating || var->root->valid_block == NULL) @@ -2412,7 +2412,7 @@ varobj_invalidate_iter (struct varobj *var, void *unused) void varobj_invalidate (void) { - all_root_varobjs (varobj_invalidate_iter, NULL); + all_root_varobjs (varobj_invalidate_iter); } /* A hash function for a varobj. */ |