diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/varobj.c | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d2c902c..6e6fcfb 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2020-12-11 Tom Tromey <tom@tromey.com> + * varobj.c (struct varobj_dynamic) <saved_item>: Now unique_ptr. + (varobj_clear_saved_item, update_dynamic_varobj_children): + Update. + +2020-12-11 Tom Tromey <tom@tromey.com> + * varobj.c (update_dynamic_varobj_children): Update. * varobj-iter.h (struct varobj_iter) <next>: Change return type. * python/py-varobj.c (struct py_varobj_iter) <next>: Change return diff --git a/gdb/varobj.c b/gdb/varobj.c index e9856ea..92bb60f 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -131,7 +131,7 @@ struct varobj_dynamic already reported. However, we don't want to install this value when we read it, because that will mess up future updates. So, we stash it here instead. */ - varobj_item *saved_item = NULL; + std::unique_ptr<varobj_item> saved_item; }; /* Private function prototypes */ @@ -680,8 +680,7 @@ varobj_clear_saved_item (struct varobj_dynamic *var) if (var->saved_item != NULL) { value_decref (var->saved_item->value); - delete var->saved_item; - var->saved_item = NULL; + var->saved_item.reset (nullptr); } } @@ -723,10 +722,7 @@ update_dynamic_varobj_children (struct varobj *var, /* See if there was a leftover from last time. */ if (var->dynamic->saved_item != NULL) - { - item = std::unique_ptr<varobj_item> (var->dynamic->saved_item); - var->dynamic->saved_item = NULL; - } + item = std::move (var->dynamic->saved_item); else { item = var->dynamic->child_iter->next (); @@ -757,7 +753,7 @@ update_dynamic_varobj_children (struct varobj *var, } else { - var->dynamic->saved_item = item.release (); + var->dynamic->saved_item = std::move (item); /* We want to truncate the child list just before this element. */ |