[PATCH 35/40] fix mi-cmd-var.c

Tom Tromey
2013-05-09T18:52:51Z

This is a stylistic change in mi-cmd-var.c that adds outer cleanups
where needed by the checker.

* mi/mi-cmd-var.c (mi_cmd_var_list_children): Add an outer
null cleanup.
(mi_cmd_var_update, varobj_update_one): Likewise.
---
gdb/mi/mi-cmd-var.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 558454e..c2e8b7a 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -441,14 +441,12 @@ mi_cmd_var_list_children (char *command, char **argv, int argc)

if (from < to)
{
- struct cleanup *cleanup_children;
+ struct cleanup *cleanup_children = make_cleanup (null_cleanup, NULL);

if (mi_version (uiout) == 1)
- cleanup_children
- = make_cleanup_ui_out_tuple_begin_end (uiout, "children");
+ make_cleanup_ui_out_tuple_begin_end (uiout, "children");
else
- cleanup_children
- = make_cleanup_ui_out_list_begin_end (uiout, "children");
+ make_cleanup_ui_out_list_begin_end (uiout, "children");
for (ix = from;
ix < to && VEC_iterate (varobj_p, children, ix, child);
++ix)
@@ -702,10 +700,11 @@ mi_cmd_var_update (char *command, char **argv, int argc)
else
print_values = PRINT_NO_VALUES;

+ cleanup = make_cleanup (null_cleanup, NULL);
if (mi_version (uiout) <= 1)
- cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
+ make_cleanup_ui_out_tuple_begin_end (uiout, "changelist");
else
- cleanup = make_cleanup_ui_out_list_begin_end (uiout, "changelist");
+ make_cleanup_ui_out_list_begin_end (uiout, "changelist");

/* Check if the parameter is a "*", which means that we want to
update all variables. */
@@ -741,7 +740,6 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
int explicit)
{
struct ui_out *uiout = current_uiout;
- struct cleanup *cleanup = NULL;
VEC (varobj_update_result) *changes;
varobj_update_result *r;
int i;
@@ -752,9 +750,10 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
{
char *display_hint;
int from, to;
+ struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);

if (mi_version (uiout) > 1)
- cleanup = make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
+ make_cleanup_ui_out_tuple_begin_end (uiout, NULL);
ui_out_field_string (uiout, "name", varobj_get_objname (r->varobj));

switch (r->status)
@@ -828,8 +827,7 @@ varobj_update_one (struct varobj *var, enum print_values print_values,
r->new = NULL; /* Paranoia. */
}

- if (mi_version (uiout) > 1)
- do_cleanups (cleanup);
+ do_cleanups (cleanup);
}
VEC_free (varobj_update_result, changes);
}
--
1.8.1.4