From 15bf30027bcb167833a0ca2c619c03f177ef1ba4 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 26 May 2018 23:21:23 -0600 Subject: Change gdbscm_exception_message_to_string to return a unique_xmalloc_ptr This changes gdbscm_exception_message_to_string to return a unique_xmalloc_ptr, allowing for the removal of some cleanups. unique_xmalloc_ptr was chosen because at the root of the call chains is a function from Guile that returns a malloc'd string. gdb/ChangeLog 2018-07-17 Tom Tromey * guile/scm-param.c (pascm_signal_setshow_error): Update. * guile/guile-internal.h (gdbscm_exception_message_to_string): Update. * guile/scm-cmd.c (cmdscm_function): Update. * guile/scm-pretty-print.c (ppscm_print_exception_unless_memory_error): Update. * guile/scm-exception.c (gdbscm_exception_message_to_string): Return unique_xmalloc_ptr. --- gdb/guile/scm-param.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/guile/scm-param.c') diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c index d48f14e..7ff4af9 100644 --- a/gdb/guile/scm-param.c +++ b/gdb/guile/scm-param.c @@ -251,10 +251,10 @@ pascm_signal_setshow_error (SCM exception, const char *msg) itself. */ if (gdbscm_user_error_p (gdbscm_exception_key (exception))) { - char *excp_text = gdbscm_exception_message_to_string (exception); + gdb::unique_xmalloc_ptr excp_text + = gdbscm_exception_message_to_string (exception); - make_cleanup (xfree, excp_text); - error ("%s", excp_text); + error ("%s", excp_text.get ()); } else { -- cgit v1.1