aboutsummaryrefslogtreecommitdiff
path: root/gdb/jit.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2017-04-28 23:08:16 -0600
committerTom Tromey <tom@tromey.com>2017-08-03 07:59:01 -0600
commit7c218e6c9c88cb8120adf1a7a530cfdec23aaf81 (patch)
treec27b200b84416e9ed7a0dda4dbae50bc060f5180 /gdb/jit.c
parent31b68d4ad72ebb153e48e16c8d9edf3676a8af38 (diff)
downloadgdb-7c218e6c9c88cb8120adf1a7a530cfdec23aaf81.zip
gdb-7c218e6c9c88cb8120adf1a7a530cfdec23aaf81.tar.gz
gdb-7c218e6c9c88cb8120adf1a7a530cfdec23aaf81.tar.bz2
Use unique_xmalloc_ptr in jit.c
This removes some cleanups from jit.c by using unique_xmalloc_ptr instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * jit.c (jit_reader_load_command): Use unique_xmalloc_ptr.
Diffstat (limited to 'gdb/jit.c')
-rw-r--r--gdb/jit.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/gdb/jit.c b/gdb/jit.c
index ddf1005..725d41e 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -211,29 +211,20 @@ jit_reader_load (const char *file_name)
static void
jit_reader_load_command (char *args, int from_tty)
{
- char *so_name;
- struct cleanup *prev_cleanup;
-
if (args == NULL)
error (_("No reader name provided."));
- args = tilde_expand (args);
- prev_cleanup = make_cleanup (xfree, args);
+ gdb::unique_xmalloc_ptr<char> file (tilde_expand (args));
if (loaded_jit_reader != NULL)
error (_("JIT reader already loaded. Run jit-reader-unload first."));
- if (IS_ABSOLUTE_PATH (args))
- so_name = args;
- else
- {
- so_name = xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING, args);
- make_cleanup (xfree, so_name);
- }
+ if (!IS_ABSOLUTE_PATH (file.get ()))
+ file.reset (xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING,
+ file.get ()));
- loaded_jit_reader = jit_reader_load (so_name);
+ loaded_jit_reader = jit_reader_load (file.get ());
reinit_frame_cache ();
jit_inferior_created_hook ();
- do_cleanups (prev_cleanup);
}
/* Provides the jit-reader-unload command. */