summaryrefslogtreecommitdiff
path: root/gdb/typeprint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/typeprint.c')
-rw-r--r--gdb/typeprint.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index 56e993e91f2..a22c6fba340 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -371,26 +371,19 @@ type_print (struct type *type, const char *varstring, struct ui_file *stream,
std::string
type_to_string (struct type *type)
{
- std::string s;
- struct ui_file *stb;
- struct cleanup *old_chain;
-
- stb = mem_fileopen ();
- old_chain = make_cleanup_ui_file_delete (stb);
-
TRY
{
- type_print (type, "", stb, -1);
- s = ui_file_as_string (stb);
+ string_file stb;
+
+ type_print (type, "", &stb, -1);
+ return std::move (stb.string ());
}
CATCH (except, RETURN_MASK_ALL)
{
}
END_CATCH
- do_cleanups (old_chain);
-
- return s;
+ return {};
}
/* Print type of EXP, or last thing in value history if EXP == NULL.