This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


>>>>> "Tom" == Tom Tromey <tromey@redhat.com> writes:

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

The new version of the checker is a little more robust here, and so I
was able to drop a couple parts of this patch.  Now the checker
understands constructs like:

if (cond)
  cleanup = something();
else
  cleanup = something_else();
...
do_cleanups (cleanup);

Tom

	* mi/mi-cmd-var.c (varobj_update_one): Add an outer null cleanup.
---
 gdb/mi/mi-cmd-var.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/mi/mi-cmd-var.c b/gdb/mi/mi-cmd-var.c
index 558454e..a069346 100644
--- a/gdb/mi/mi-cmd-var.c
+++ b/gdb/mi/mi-cmd-var.c
@@ -741,7 +741,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 +751,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 +828,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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]