diff options
author | Andrew Burgess <aburgess@redhat.com> | 2021-11-08 14:58:46 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2021-11-16 17:45:45 +0000 |
commit | 8579fd136a614985bd27f20539c7bb7c5a51287d (patch) | |
tree | fb84850409a44e13e832cbadc9025d40c1d33d9f /gdb/breakpoint.c | |
parent | 2bb7589ddf61e163f2e414e7033fad56ea17e784 (diff) | |
download | gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.zip gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.gz gdb-8579fd136a614985bd27f20539c7bb7c5a51287d.tar.bz2 |
gdb/gdbsupport: make xstrprintf and xstrvprintf return a unique_ptr
The motivation is to reduce the number of places where unmanaged
pointers are returned from allocation type routines. All of the
callers are updated.
There should be no user visible changes after this commit.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r-- | gdb/breakpoint.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 86dffb4..d98c3a7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -8728,7 +8728,7 @@ static void update_dprintf_command_list (struct breakpoint *b) { const char *dprintf_args = b->extra_string.get (); - char *printf_line = NULL; + gdb::unique_xmalloc_ptr<char> printf_line = nullptr; if (!dprintf_args) return; @@ -8779,7 +8779,7 @@ update_dprintf_command_list (struct breakpoint *b) /* Manufacture a printf sequence. */ struct command_line *printf_cmd_line - = new struct command_line (simple_control, printf_line); + = new struct command_line (simple_control, printf_line.release ()); breakpoint_set_commands (b, counted_command_line (printf_cmd_line, command_lines_deleter ())); } @@ -10798,9 +10798,8 @@ watch_command_1 (const char *arg, int accessflag, int from_tty, w->exp_string_reparse = current_language->watch_location_expression (t, addr); - w->exp_string.reset (xstrprintf ("-location %.*s", - (int) (exp_end - exp_start), - exp_start)); + w->exp_string = xstrprintf ("-location %.*s", + (int) (exp_end - exp_start), exp_start); } else w->exp_string.reset (savestring (exp_start, exp_end - exp_start)); |