From a36158ec0c5145bc3988d9513081a2819353b179 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Thu, 2 Jul 2020 20:38:53 -0400 Subject: gdb: make macro_stringify return a gdb::unique_xmalloc_ptr The change to macro_stringify is straightforward. This allows removing the manual memory management in fixup_definition. gdb/ChangeLog: * macroexp.h (macro_stringify): Return gdb::unique_xmalloc_ptr. * macroexp.c (macro_stringify): Likewise. * macrotab.c (fixup_definition): Update. Change-Id: Id7db8988bdbd569dd51c4f4655b00eb26db277cb --- gdb/macroexp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gdb/macroexp.c') diff --git a/gdb/macroexp.c b/gdb/macroexp.c index e1d185d..5f749ff 100644 --- a/gdb/macroexp.c +++ b/gdb/macroexp.c @@ -698,7 +698,7 @@ stringify (struct macro_buffer *dest, const char *arg, int len) /* See macroexp.h. */ -char * +gdb::unique_xmalloc_ptr macro_stringify (const char *str) { int len = strlen (str); @@ -707,7 +707,7 @@ macro_stringify (const char *str) stringify (&buffer, str, len); buffer.appendc ('\0'); - return buffer.release ().release (); + return buffer.release (); } -- cgit v1.1