/* varobj support for Ada.
- Copyright (C) 2012-2016 Free Software Foundation, Inc.
+ Copyright (C) 2012-2017 Free Software Foundation, Inc.
This file is part of GDB.
static std::string
ada_varobj_scalar_image (struct type *type, LONGEST val)
{
- struct ui_file *buf = mem_fileopen ();
- struct cleanup *cleanups = make_cleanup_ui_file_delete (buf);
+ string_file buf;
- ada_print_scalar (type, val, buf);
- std::string result = ui_file_as_string (buf);
- do_cleanups (cleanups);
-
- return result;
+ ada_print_scalar (type, val, &buf);
+ return std::move (buf.string ());
}
/* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair designates
ada_varobj_get_value_image (struct value *value,
struct value_print_options *opts)
{
- struct ui_file *buffer;
- struct cleanup *old_chain;
-
- buffer = mem_fileopen ();
- old_chain = make_cleanup_ui_file_delete (buffer);
-
- common_val_print (value, buffer, 0, opts, current_language);
- std::string result = ui_file_as_string (buffer);
+ string_file buffer;
- do_cleanups (old_chain);
- return result;
+ common_val_print (value, &buffer, 0, opts, current_language);
+ return std::move (buffer.string ());
}
/* Assuming that the (VALUE, TYPE) pair designates an array varobj,