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: [RFA 2/5] Introduce ui_file_up and use it to remove cleanups


> +++ b/gdb/ada-lang.c
> @@ -7602,16 +7602,11 @@ ada_value_struct_elt (struct value *arg, char *name, int no_err)
>  static std::string
>  type_as_string (struct type *type)
>  {
> -  struct ui_file *tmp_stream = mem_fileopen ();
> -  struct cleanup *old_chain;
> -
> -  tmp_stream = mem_fileopen ();
> -  old_chain = make_cleanup_ui_file_delete (tmp_stream);
> +  ui_file_up tmp_stream = mem_fileopen ();
>  
> -  type_print (type, "", tmp_stream, -1);
> -  std::string str = ui_file_as_string (tmp_stream);
> +  type_print (type, "", tmp_stream.get (), -1);
> +  std::string str = ui_file_as_string (tmp_stream.get ());
>  
> -  do_cleanups (old_chain);
>    return str;

you could just get rid of the str variable here and a bunch of other
places right?  Though obviously that can happen later.

Trev


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