diff options
author | Tom Tromey <tom@tromey.com> | 2023-02-16 17:36:29 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2023-02-17 19:05:04 -0500 |
commit | be643e074f3081b537a11c87c1ccf1d400f2945e (patch) | |
tree | 898428fd0a1f6b943246c5737707925d6d3367c7 /gdb/go-lang.h | |
parent | 22e1578cc831ab97a34d8bddcba73544a4fce6b8 (diff) | |
download | gdb-be643e074f3081b537a11c87c1ccf1d400f2945e.zip gdb-be643e074f3081b537a11c87c1ccf1d400f2945e.tar.gz gdb-be643e074f3081b537a11c87c1ccf1d400f2945e.tar.bz2 |
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>
Diffstat (limited to 'gdb/go-lang.h')
-rw-r--r-- | gdb/go-lang.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gdb/go-lang.h b/gdb/go-lang.h index 1820b4c..3b1aa5c 100644 --- a/gdb/go-lang.h +++ b/gdb/go-lang.h @@ -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); - -extern char *go_block_package_name (const struct block *block); +/* 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); + +/* 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 *); |