From 919f402ca5eae1caf53ed2b9caffc9a50e92cdd0 Mon Sep 17 00:00:00 2001 From: Harti Brandt Date: Fri, 18 Nov 2011 16:09:29 +0000 Subject: [PATCH] re PR libstdc++/51209 (The template _M_find_node in hashtable.h has a bad return value) 2011-11-18 Harti Brandt PR libstdc++/51209 * include/bits/hashtable.h (_Hashtable<>::_M_find_node): Return nullptr when no node is found. * include/tr1/hashtable.h (_Hashtable<>::_M_find_node): Return zero when no node is found. From-SVN: r181480 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/hashtable.h | 4 ++-- libstdc++-v3/include/tr1/hashtable.h | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0d68464933c..235aa0578d4 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2011-11-18 Harti Brandt + + PR libstdc++/51209 + * include/bits/hashtable.h (_Hashtable<>::_M_find_node): Return + nullptr when no node is found. + * include/tr1/hashtable.h (_Hashtable<>::_M_find_node): Return + zero when no node is found. + 2011-11-18 Paolo Carlini * src/hash-long-double-aux.cc: Rename to... diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 203999d9ca0..83cef2d4ca4 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -873,7 +873,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // Find the node whose key compares equal to k, beginning the search - // at p (usually the head of a bucket). Return nil if no node is found. + // at p (usually the head of a bucket). Return nullptr if no node is found. template_M_next) if (this->_M_compare(__k, __code, __p)) return __p; - return false; + return nullptr; } // Insert v in bucket n (assumes no element with its key already present). diff --git a/libstdc++-v3/include/tr1/hashtable.h b/libstdc++-v3/include/tr1/hashtable.h index 5d1e02c2592..5e17b238a1f 100644 --- a/libstdc++-v3/include/tr1/hashtable.h +++ b/libstdc++-v3/include/tr1/hashtable.h @@ -813,7 +813,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // Find the node whose key compares equal to k, beginning the search - // at p (usually the head of a bucket). Return nil if no node is found. + // at p (usually the head of a bucket). Return zero if no node is found. template_M_next) if (this->_M_compare(__k, __code, __p)) return __p; - return false; + return 0; } // Insert v in bucket n (assumes no element with its key already present).