Avoid manual memory management in go-lang.c

I noticed a couple of spots in go-lang.c that could be improved by
using unique_ptr.

Reviewed-By: Andrew Burgess <aburgess@redhat.com>
This commit is contained in:
Tom Tromey
2023-02-16 17:36:29 -07:00
parent 22e1578cc8
commit be643e074f
4 changed files with 30 additions and 29 deletions

View File

@ -63,9 +63,14 @@ extern const char *go_main_name (void);
extern enum go_type go_classify_struct_type (struct type *type);
extern char *go_symbol_package_name (const struct symbol *sym);
/* Given a Go symbol, return its package or nullptr if unknown. */
extern gdb::unique_xmalloc_ptr<char> go_symbol_package_name
(const struct symbol *sym);
extern char *go_block_package_name (const struct block *block);
/* Return the package that BLOCK is in, or nullptr if there isn't
one. */
extern gdb::unique_xmalloc_ptr<char> go_block_package_name
(const struct block *block);
extern const struct builtin_go_type *builtin_go_type (struct gdbarch *);