From 7912c5385e224e5c993d08584eb5c22d5f9a341b Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Wed, 30 Sep 2009 16:15:29 -0700 Subject: [PATCH] Add clear method to subr::sharing_stack. --- libdw/ChangeLog | 2 ++ libdw/c++/subr.hh | 14 +++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/libdw/ChangeLog b/libdw/ChangeLog index e6546ee1a..498e6ef32 100644 --- a/libdw/ChangeLog +++ b/libdw/ChangeLog @@ -1,5 +1,7 @@ 2009-09-30 Roland McGrath + * c++/subr.hh (subr::sharing_stack::clear): New method. + * c++/values.cc (dwarf::attr_value::what_space): Grok exprloc, flag_present, sec_offset. diff --git a/libdw/c++/subr.hh b/libdw/c++/subr.hh index 921a79727..79e1c7559 100644 --- a/libdw/c++/subr.hh +++ b/libdw/c++/subr.hh @@ -1184,15 +1184,19 @@ namespace elfutils _m_size = n; } - inline void fini () + public: + inline void clear () { if (_m_head == NULL) assert (_m_size == 0); else - _m_head->release (); + { + _m_head->release (); + _m_head = NULL; + _m_size = 0; + } } - public: inline bool empty () const { return _m_head == NULL; @@ -1254,14 +1258,14 @@ namespace elfutils inline ~sharing_stack () { - fini (); + clear (); } inline sharing_stack &operator= (const sharing_stack &other) { if (&other != this) { - fini (); + clear (); init (other._m_head, other._m_size); } return *this; -- 2.47.3