forked from Imagelibrary/binutils-gdb
Change target_read_string to use unique_xmalloc_ptr
This changes the out parameter of target_read_string to be a unique_xmalloc_ptr. This avoids a cleanup and sets the stage for more cleanup removals. This patch also removes a seemingly needless alloca from print_subexp_standard. gdb/ChangeLog 2018-03-30 Tom Tromey <tom@tromey.com> * windows-nat.c (handle_output_debug_string, handle_exception): Update. * target.h (target_read_string): Update. * target.c (target_read_string): Change "string" to unique_xmalloc_ptr. * solib-svr4.c (open_symbol_file_object, svr4_read_so_list): Update. * solib-frv.c (frv_current_sos): Update. * solib-dsbt.c (dsbt_current_sos): Update. * solib-darwin.c (darwin_current_sos): Update. * linux-thread-db.c (inferior_has_bug): Update. * expprint.c (print_subexp_standard) <case OP_OBJC_MSGCALL>: Update. Remove alloca. * ada-lang.c (ada_main_name): Update.
This commit is contained in:
@@ -993,7 +993,8 @@ target_xfer_status_to_string (enum target_xfer_status status)
|
||||
read. */
|
||||
|
||||
int
|
||||
target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
|
||||
target_read_string (CORE_ADDR memaddr, gdb::unique_xmalloc_ptr<char> *string,
|
||||
int len, int *errnop)
|
||||
{
|
||||
int tlen, offset, i;
|
||||
gdb_byte buf[4];
|
||||
@@ -1053,7 +1054,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
|
||||
nbytes_read += tlen;
|
||||
}
|
||||
done:
|
||||
*string = buffer;
|
||||
string->reset (buffer);
|
||||
if (errnop != NULL)
|
||||
*errnop = errcode;
|
||||
return nbytes_read;
|
||||
|
||||
Reference in New Issue
Block a user