X-Git-Url: https://ginac.de/CLN/cln.git//cln.git?a=blobdiff_plain;f=src%2Fbase%2Fhash%2Fcl_hash.h;h=6a9f14eb59e9b877bbaf8010619c2231abe906bb;hb=850abfde7f0d985ba01526c346bcd0d733562943;hp=2e92ffd2606d71ae2bb390e24b287acef8432e61;hpb=e0b64ba4f92bb0323e5b241b465d17389ceff2d9;p=cln.git diff --git a/src/base/hash/cl_hash.h b/src/base/hash/cl_hash.h index 2e92ffd..6a9f14e 100644 --- a/src/base/hash/cl_hash.h +++ b/src/base/hash/cl_hash.h @@ -3,11 +3,13 @@ #ifndef _CL_HASH_H #define _CL_HASH_H -#include "cl_object.h" -#include "cl_malloc.h" -#include "cl_abort.h" +#include "cln/object.h" +#include "cln/malloc.h" +#include "cln/abort.h" #include "cl_iterator.h" +namespace cln { + const long htentry_last = 0; // means that there is no next entry // These forward declarations are needed for Sun CC 3.0.1 and 4.0.1. @@ -35,15 +37,15 @@ protected: // a normal hash table into a "weak" hash table. public: // Allocation. - void* operator new (size_t size) { return cl_malloc_hook(size); } + void* operator new (size_t size) { return malloc_hook(size); } // Deallocation. - void operator delete (void* ptr) { cl_free_hook(ptr); } + void operator delete (void* ptr) { free_hook(ptr); } // Constructor: build a new, empty table. cl_heap_hashtable (long initial_size = 5) : cl_heap (), _size (initial_size), _count (0), _garcol_fun (no_garcol) { _modulus = compute_modulus(_size); - _total_vector = cl_malloc_hook(_modulus*sizeof(long) + _size*sizeof(htxentry)); + _total_vector = malloc_hook(_modulus*sizeof(long) + _size*sizeof(htxentry)); _slots = (long*) ((char*)_total_vector + 0); _entries = (htxentry *) ((char*)_total_vector + _modulus*sizeof(long)); for (var long hi = _modulus-1; hi >= 0; hi--) @@ -61,7 +63,7 @@ public: for (long i = 0; i < _size; i++) if (_entries[i].next >= 0) _entries[i].~htxentry(); - cl_free_hook(_total_vector); + free_hook(_total_vector); } // Count number of entries. long num_entries () @@ -186,5 +188,6 @@ inline _cl_hashtable_iterator cl_heap_hashtable::iterator () #endif } +} // namespace cln #endif /* _CL_HASH_H */