summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2016-10-28 23:08:08 +0100
committerPedro Alves <palves@redhat.com>2016-11-17 03:10:00 +0000
commit3d4ed53ca597f71c72ff0db995468578482a0ee0 (patch)
tree23c91cebc43c07ae98f0a494642734aa8abc83f5 /gdb/gdbtypes.c
parent05c10af4c15d9501046f6740cdf1173fbd9c3a2e (diff)
downloadbinutils-gdb-users/palves/cxx-eliminate-cleanups.tar.gz
Eliminate make_cleanup_ui_file_deleteusers/palves/cxx-eliminate-cleanups
And now that ui_file_as_string is in, let's eliminate it. :-) Makes ui_file a real C++ hierarchy. mem_fileopen is replaced with a new string_file class that is treated as a value class created on the stack. This alone eliminates most make_cleanup_ui_file_delete calls, and, simplifies code a whole lot (diffstat shows almost 1k loc dropped.) string_file has a string() method that gives you a direct reference to the internal std::string. This is what replaces old (well, new) ui_file_as_string, which used to alway return a new copy of the same data the stream had inside.. With direct access via a writable reference, we can instead move the string out of the string_stream. Note I needed a tweak on scoped_restore. That one should probably be split out to a separate patch. This exposed the need to make use of gnulib namespace support. Otherwise, making use of read/write/printf/puts/etc symbol names will clash on systems where gnulib replaces those functions, due to '#define foo rpl_foo'.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index 786a8a8f77e..c519871ab55 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2459,7 +2459,7 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
/* Suppress error messages. */
saved_gdb_stderr = gdb_stderr;
- gdb_stderr = ui_file_new ();
+ gdb_stderr = &null_stream;
/* Call parse_and_eval_type() without fear of longjmp()s. */
TRY
@@ -2473,7 +2473,6 @@ safe_parse_type (struct gdbarch *gdbarch, char *p, int length)
END_CATCH
/* Stop suppressing error messages. */
- ui_file_delete (gdb_stderr);
gdb_stderr = saved_gdb_stderr;
return type;