diff options
author | Tom Tromey <tom@tromey.com> | 2018-03-27 14:31:10 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-03-30 13:22:58 -0600 |
commit | e83e4e24021acb4b095b1e8a45a51c2ea088a1ed (patch) | |
tree | 4740a6532e556fbb49a7de4234c2913796366212 /gdb/solib-darwin.c | |
parent | 263db9a1f4105b76ddf00829d50430ea0a3bcba6 (diff) | |
download | gdb-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.zip gdb-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.tar.gz gdb-e83e4e24021acb4b095b1e8a45a51c2ea088a1ed.tar.bz2 |
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.
Diffstat (limited to 'gdb/solib-darwin.c')
-rw-r--r-- | gdb/solib-darwin.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index cf15148..d66938f 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -261,7 +261,7 @@ darwin_current_sos (void) CORE_ADDR path_addr; struct mach_o_header_external hdr; unsigned long hdr_val; - char *file_path; + gdb::unique_xmalloc_ptr<char> file_path; int errcode; struct so_list *newobj; struct cleanup *old_chain; @@ -299,10 +299,9 @@ darwin_current_sos (void) lm_info_darwin *li = new lm_info_darwin; newobj->lm_info = li; - strncpy (newobj->so_name, file_path, SO_NAME_MAX_PATH_SIZE - 1); + strncpy (newobj->so_name, file_path.get (), SO_NAME_MAX_PATH_SIZE - 1); newobj->so_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; strcpy (newobj->so_original_name, newobj->so_name); - xfree (file_path); li->lm_addr = load_addr; if (head == NULL) |