X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fbase%2Fhash%2Fcl_hash.h;h=92fbe8be334cfa4593ca367cd97e1fe30aa87df2;hb=67afbefaff61817e08faf507f74f1bb8f5206a8a;hp=4b34589141d138e6dd2cd2e5ea51aace23e4e3bb;hpb=3383e943c4acbd8acff8d31b85d71656b64e2450;p=cln.git diff --git a/src/base/hash/cl_hash.h b/src/base/hash/cl_hash.h index 4b34589..92fbe8b 100644 --- a/src/base/hash/cl_hash.h +++ b/src/base/hash/cl_hash.h @@ -5,7 +5,7 @@ #include "cln/object.h" #include "cln/malloc.h" -#include "cln/abort.h" +#include "cln/exception.h" #include "cl_iterator.h" namespace cln { @@ -17,7 +17,7 @@ template struct _cl_hashtable_iterator; template struct cl_heap_hashtable : public cl_heap { - friend struct _cl_hashtable_iterator; + friend struct _cl_hashtable_iterator; protected: typedef struct htxentry { long next; // > 0: pseudo-list continues at next-1 @@ -33,7 +33,7 @@ protected: long * _slots; // vector of length _modulus htxentry * _entries; // vector of length _size void* _total_vector; - cl_boolean (*_garcol_fun) (cl_heap*); // Function to make room in the table. + bool (*_garcol_fun) (cl_heap*); // Function to make room in the table. // Putting some intelligent function here turns // a normal hash table into a "weak" hash table. public: @@ -132,7 +132,7 @@ protected: return index; } #if !(defined(__hppa__) && !defined(__GNUC__)) // workaround HP CC problem - cl_abort(); + throw runtime_exception(); #endif return -1; // dummy } @@ -144,7 +144,7 @@ protected: } private: // Default function to make room in a hash table. - static cl_boolean no_garcol (cl_heap* ht) { unused ht; return cl_false; } + static bool no_garcol (cl_heap* ht) { unused ht; return false; } }; template @@ -170,7 +170,7 @@ public: htentry& next () { if (_index < 0) - cl_abort(); + throw runtime_exception(); var long old_index = _index; do { _index--; } while (_index >= 0 && _entries[_index].next < 0); @@ -181,12 +181,7 @@ public: template inline _cl_hashtable_iterator cl_heap_hashtable::iterator () { -#if defined(__GNUC__) - return _cl_hashtable_iterator::_cl_hashtable_iterator(_entries,_size); -#else // workaround most C++ compilers' bug - typedef _cl_hashtable_iterator _cl_hashtable_iterator_type; - return _cl_hashtable_iterator_type(_entries,_size); -#endif + return _cl_hashtable_iterator(_entries,_size); } } // namespace cln