--- parser3/src/main/Attic/pa_hash.C 2001/01/27 12:04:43 1.2 +++ parser3/src/main/Attic/pa_hash.C 2001/02/20 18:45:53 1.12 @@ -1,5 +1,5 @@ /* - $Id: pa_hash.C,v 1.2 2001/01/27 12:04:43 paf Exp $ + $Id: pa_hash.C,v 1.12 2001/02/20 18:45:53 paf Exp $ */ /* @@ -10,11 +10,11 @@ For more information about Zend please visit http://www.zend.com/ */ -#include "pa_pool.h" +#include "pa_hash.h" +#include "pa_threads.h" - -void *Hash::Pair::operator new(size_t size, Pool *apool) { - return apool->malloc(size); +void *Hash::Pair::operator new(size_t size, Pool& apool) { + return apool.malloc(size); } /* Zend comment: Generated on an Octa-ALPHA 300MHz CPU & 2.5GB RAM monster */ @@ -26,27 +26,25 @@ uint Hash::sizes[]={ int Hash::sizes_count= sizeof(sizes)/sizeof(uint); -void *Hash::operator new(size_t size, Pool *apool) { - return apool->malloc(size); -} -Hash::Hash(Pool *apool) { - pool=apool; +Hash::Hash(Pool& apool, bool athread_safe) : + Pooled(apool), + thread_safe(athread_safe) { size=sizes[size_index=0]; threshold=size*THRESHOLD_PERCENT/100; used=0; - refs=static_cast(pool->calloc(sizeof(Pair *)*size)); + refs=static_cast(pool().calloc(sizeof(Pair *)*size)); } void Hash::expand() { int old_size=size; Pair **old_refs=refs; - + // allocated bigger refs array size_index=size_index+1(pool->calloc(sizeof(Pair *)*size)); + refs=static_cast(pool().calloc(sizeof(Pair *)*size)); // rehash Pair **old_ref=old_refs; @@ -63,9 +61,9 @@ void Hash::expand() { } } -uint Hash::generic_code(uint aresult, char *start, uint size) { +uint Hash::generic_code(uint aresult, const char *start, uint size) { uint result=aresult, g; - char *end=start+size; + const char *end=start+size; while (startlink)