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.
This commit is contained in:
parent
31b68d4ad7
commit
7c218e6c9c
|
@ -1,3 +1,7 @@
|
||||||
|
2017-08-03 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* jit.c (jit_reader_load_command): Use unique_xmalloc_ptr.
|
||||||
|
|
||||||
2017-08-03 Tom Tromey <tom@tromey.com>
|
2017-08-03 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* tui/tui-regs.c (tui_restore_gdbout): Remove.
|
* tui/tui-regs.c (tui_restore_gdbout): Remove.
|
||||||
|
|
19
gdb/jit.c
19
gdb/jit.c
|
@ -211,29 +211,20 @@ jit_reader_load (const char *file_name)
|
||||||
static void
|
static void
|
||||||
jit_reader_load_command (char *args, int from_tty)
|
jit_reader_load_command (char *args, int from_tty)
|
||||||
{
|
{
|
||||||
char *so_name;
|
|
||||||
struct cleanup *prev_cleanup;
|
|
||||||
|
|
||||||
if (args == NULL)
|
if (args == NULL)
|
||||||
error (_("No reader name provided."));
|
error (_("No reader name provided."));
|
||||||
args = tilde_expand (args);
|
gdb::unique_xmalloc_ptr<char> file (tilde_expand (args));
|
||||||
prev_cleanup = make_cleanup (xfree, args);
|
|
||||||
|
|
||||||
if (loaded_jit_reader != NULL)
|
if (loaded_jit_reader != NULL)
|
||||||
error (_("JIT reader already loaded. Run jit-reader-unload first."));
|
error (_("JIT reader already loaded. Run jit-reader-unload first."));
|
||||||
|
|
||||||
if (IS_ABSOLUTE_PATH (args))
|
if (!IS_ABSOLUTE_PATH (file.get ()))
|
||||||
so_name = args;
|
file.reset (xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING,
|
||||||
else
|
file.get ()));
|
||||||
{
|
|
||||||
so_name = xstrprintf ("%s%s%s", jit_reader_dir, SLASH_STRING, args);
|
|
||||||
make_cleanup (xfree, so_name);
|
|
||||||
}
|
|
||||||
|
|
||||||
loaded_jit_reader = jit_reader_load (so_name);
|
loaded_jit_reader = jit_reader_load (file.get ());
|
||||||
reinit_frame_cache ();
|
reinit_frame_cache ();
|
||||||
jit_inferior_created_hook ();
|
jit_inferior_created_hook ();
|
||||||
do_cleanups (prev_cleanup);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides the jit-reader-unload command. */
|
/* Provides the jit-reader-unload command. */
|
||||||
|
|
Loading…
Reference in New Issue