#include "cln/object.h"
#include "cln/malloc.h"
-#include "cln/abort.h"
+#include "cln/exception.h"
#include "cl_iterator.h"
namespace cln {
template <class htentry>
struct cl_heap_hashtable : public cl_heap {
- friend struct _cl_hashtable_iterator<htentry>;
+ friend struct _cl_hashtable_iterator<htentry>;
protected:
typedef struct htxentry {
long next; // > 0: pseudo-list continues at next-1
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:
return index;
}
#if !(defined(__hppa__) && !defined(__GNUC__)) // workaround HP CC problem
- cl_abort();
+ throw runtime_exception();
#endif
return -1; // dummy
}
}
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 <class htentry>
htentry& next ()
{
if (_index < 0)
- cl_abort();
+ throw runtime_exception();
var long old_index = _index;
do { _index--; }
while (_index >= 0 && _entries[_index].next < 0);
template <class htentry>
inline _cl_hashtable_iterator<htentry> cl_heap_hashtable<htentry>::iterator ()
{
-#if defined(__GNUC__)
- return _cl_hashtable_iterator<htentry>::_cl_hashtable_iterator(_entries,_size);
-#else // workaround most C++ compilers' bug
- typedef _cl_hashtable_iterator<htentry> _cl_hashtable_iterator_type;
- return _cl_hashtable_iterator_type(_entries,_size);
-#endif
+ return _cl_hashtable_iterator<htentry>(_entries,_size);
}
} // namespace cln