From 87028b873938aa3cc756c99e33a328640dbc30bc Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 12 Oct 2017 18:20:09 -0600 Subject: Return unique_xmalloc_ptr from target_fileio_read_stralloc Change target_fileio_read_stralloc to return unique_xmalloc_ptr and fix up the callers. This removes a number of cleanups. ChangeLog 2017-10-16 Tom Tromey * linux-tdep.c (linux_info_proc, linux_find_memory_regions_full) (linux_fill_prpsinfo, linux_vsyscall_range_raw): Update. * target.c (target_fileio_read_stralloc): Update. * sparc64-tdep.c (adi_is_addr_mapped): Update. * target.h (target_fileio_read_stralloc): Return unique_xmalloc_ptr. --- gdb/target.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gdb/target.c') diff --git a/gdb/target.c b/gdb/target.c index 94307cb..6fa9d59 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -3083,7 +3083,7 @@ target_fileio_read_alloc (struct inferior *inf, const char *filename, /* See target.h. */ -char * +gdb::unique_xmalloc_ptr target_fileio_read_stralloc (struct inferior *inf, const char *filename) { gdb_byte *buffer; @@ -3094,10 +3094,10 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) bufstr = (char *) buffer; if (transferred < 0) - return NULL; + return gdb::unique_xmalloc_ptr (nullptr); if (transferred == 0) - return xstrdup (""); + return gdb::unique_xmalloc_ptr (xstrdup ("")); bufstr[transferred] = 0; @@ -3111,7 +3111,7 @@ target_fileio_read_stralloc (struct inferior *inf, const char *filename) break; } - return bufstr; + return gdb::unique_xmalloc_ptr (bufstr); } -- cgit v1.1