aboutsummaryrefslogtreecommitdiff
path: root/gdb/interps.h
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-06-17 09:31:44 -0600
committerTom Tromey <tromey@adacore.com>2022-06-22 13:28:55 -0600
commit3af607d998587de460b9e29996b1d43fa40a76b0 (patch)
treec935f7fb5201489144362f33510540d4d5983407 /gdb/interps.h
parent90b7a5df152a64d2bea20beb438e8b81049a5c30 (diff)
downloadbinutils-3af607d998587de460b9e29996b1d43fa40a76b0.zip
binutils-3af607d998587de460b9e29996b1d43fa40a76b0.tar.gz
binutils-3af607d998587de460b9e29996b1d43fa40a76b0.tar.bz2
Use unique_xmalloc_ptr in interp
This changes interp::m_name to be a unique_xmalloc_ptr, removing some manual memory management. It also cleans up the initialization of the 'inited' member, and moves the 'private:' and 'public:' keywords to their proper spots.
Diffstat (limited to 'gdb/interps.h')
-rw-r--r--gdb/interps.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/gdb/interps.h b/gdb/interps.h
index 330c1ba..e393b08 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -78,20 +78,20 @@ public:
const char *name () const
{
- return m_name;
+ return m_name.get ();
}
- /* This is the name in "-i=" and "set interpreter". */
private:
- char *m_name;
+ /* This is the name in "-i=" and "set interpreter". */
+ gdb::unique_xmalloc_ptr<char> m_name;
+public:
/* Interpreters are stored in a linked list, this is the next
one... */
-public:
struct interp *next;
/* Has the init method been run? */
- bool inited;
+ bool inited = false;
};
/* Look up the interpreter for NAME, creating one if none exists yet.