]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: [_Hashtable] Optimize destructor
authorFrançois Dumont <fdumont@gcc.gnu.org>
Thu, 25 Apr 2024 16:45:59 +0000 (18:45 +0200)
committerFrançois Dumont <frs.dumont@gmail.com>
Mon, 10 Jun 2024 16:57:32 +0000 (18:57 +0200)
Hashtable destructor do not need to call clear() method that in addition to
destroying all nodes also reset all buckets to nullptr.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (~_Hashtable()): Replace clear call with
a _M_deallocate_nodes call.

libstdc++-v3/include/bits/hashtable.h

index cd3e1ac297c5c153b5f533c35d4741ff3dec479e..6e78cb7d9c09e4611d02f49bf697e2b1fdfac9e0 100644 (file)
@@ -1664,7 +1664,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
                    "Cache the hash code or qualify your functors involved"
                    " in hash code and bucket index computation with noexcept");
 
-      clear();
+      this->_M_deallocate_nodes(_M_begin());
       _M_deallocate_buckets();
     }