Return std::string from memory_error_message

This changes memory_error_message to return a std::string and fixes up
the callers.  This removes some cleanups.

ChangeLog
2017-09-03  Tom Tromey  <tom@tromey.com>

	* valprint.c (val_print_string): Update.
	* gdbcore.h (memory_error_message): Return std::string.
	* corefile.c (memory_error_message): Return std::string.
	(memory_error): Update.
	* breakpoint.c (insert_bp_location): Update.
This commit is contained in:
Tom Tromey
2017-08-05 16:23:18 -06:00
parent 0e30d99180
commit 1ccbe9985f
5 changed files with 23 additions and 22 deletions

View File

@@ -2988,13 +2988,10 @@ val_print_string (struct type *elttype, const char *encoding,
if (err != 0)
{
char *str;
str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr);
make_cleanup (xfree, str);
std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr);
fprintf_filtered (stream, "<error: ");
fputs_filtered (str, stream);
fputs_filtered (str.c_str (), stream);
fprintf_filtered (stream, ">");
}