Lines Matching defs:pH

22267 SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
22270 assert( pH!=0 );
22271 elem = pH->first;
22272 pH->first = 0;
22273 sqlite3_free(pH->ht);
22274 pH->ht = 0;
22275 pH->htsize = 0;
22281 pH->count = 0;
22298 /* Link pNew element into the hash table pH. If pEntry!=0 then also
22302 Hash *pH, /* The complete hash table */
22318 else { pH->first = pNew; }
22321 pNew->next = pH->first;
22322 if( pH->first ){ pH->first->prev = pNew; }
22324 pH->first = pNew;
22335 static int rehash(Hash *pH, unsigned int new_size){
22343 if( new_size==pH->htsize ) return 0;
22355 sqlite3_free(pH->ht);
22356 pH->ht = new_ht;
22357 pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
22359 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
22362 insertElement(pH, &new_ht[h], elem);
22372 const Hash *pH, /* The pH to be searched */
22380 if( pH->ht ){
22381 struct _ht *pEntry = &pH->ht[h];
22385 elem = pH->first;
22386 count = pH->count;
22401 Hash *pH, /* The pH containing "elem" */
22402 HashElem* elem, /* The element to be removed from the pH */
22409 pH->first = elem->next;
22414 if( pH->ht ){
22415 pEntry = &pH->ht[h];
22423 pH->count--;
22424 if( pH->count<=0 ){
22425 assert( pH->first==0 );
22426 assert( pH->count==0 );
22427 sqlite3HashClear(pH);
22431 /* Attempt to locate an element of the hash table pH with a key
22435 SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){
22439 assert( pH!=0 );
22442 if( pH->ht ){
22443 h = strHash(pKey, nKey) % pH->htsize;
22447 elem = findElementGivenHash(pH, pKey, nKey, h);
22451 /* Insert an element into the hash table pH. The key is pKey,nKey
22465 SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){
22468 HashElem *new_elem; /* New element added to the pH */
22470 assert( pH!=0 );
22473 if( pH->htsize ){
22474 h = strHash(pKey, nKey) % pH->htsize;
22478 elem = findElementGivenHash(pH,pKey,nKey,h);
22482 removeElementGivenHash(pH,elem,h);
22496 pH->count++;
22497 if( pH->count>=10 && pH->count > 2*pH->htsize ){
22498 if( rehash(pH, pH->count*2) ){
22499 assert( pH->htsize>0 );
22500 h = strHash(pKey, nKey) % pH->htsize;
22503 if( pH->ht ){
22504 insertElement(pH, &pH->ht[h], new_elem);
22506 insertElement(pH, 0, new_elem);
123420 SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){
123423 assert( pH!=0 );
123424 elem = pH->first;
123425 pH->first = 0;
123426 fts3HashFree(pH->ht);
123427 pH->ht = 0;
123428 pH->htsize = 0;
123431 if( pH->copyKey && elem->pKey ){
123437 pH->count = 0;
123513 Fts3Hash *pH, /* The complete hash table */
123523 else { pH->first = pNew; }
123526 pNew->next = pH->first;
123527 if( pH->first ){ pH->first->prev = pNew; }
123529 pH->first = pNew;
123542 static int fts3Rehash(Fts3Hash *pH, int new_size){
123550 fts3HashFree(pH->ht);
123551 pH->ht = new_ht;
123552 pH->htsize = new_size;
123553 xHash = ftsHashFunction(pH->keyClass);
123554 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
123557 fts3HashInsertElement(pH, &new_ht[h], elem);
123567 const Fts3Hash *pH, /* The pH to be searched */
123576 if( pH->ht ){
123577 struct _fts3ht *pEntry = &pH->ht[h];
123580 xCompare = ftsCompareFunction(pH->keyClass);
123595 Fts3Hash *pH, /* The pH containing "elem" */
123596 Fts3HashElem* elem, /* The element to be removed from the pH */
123603 pH->first = elem->next;
123608 pEntry = &pH->ht[h];
123616 if( pH->copyKey && elem->pKey ){
123620 pH->count--;
123621 if( pH->count<=0 ){
123622 assert( pH->first==0 );
123623 assert( pH->count==0 );
123624 fts3HashClear(pH);
123629 const Fts3Hash *pH,
123636 if( pH==0 || pH->ht==0 ) return 0;
123637 xHash = ftsHashFunction(pH->keyClass);
123640 assert( (pH->htsize & (pH->htsize-1))==0 );
123641 return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
123645 ** Attempt to locate an element of the hash table pH with a key
123649 SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){
123652 pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);
123656 /* Insert an element into the hash table pH. The key is pKey,nKey
123672 Fts3Hash *pH, /* The hash table to insert into */
123680 Fts3HashElem *new_elem; /* New element added to the pH */
123683 assert( pH!=0 );
123684 xHash = ftsHashFunction(pH->keyClass);
123687 assert( (pH->htsize & (pH->htsize-1))==0 );
123688 h = hraw & (pH->htsize-1);
123689 elem = fts3FindElementByHash(pH,pKey,nKey,h);
123693 fts3RemoveElementByHash(pH,elem,h);
123700 if( (pH->htsize==0 && fts3Rehash(pH,8))
123701 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
123703 pH->count = 0;
123706 assert( pH->htsize>0 );
123709 if( pH->copyKey && pKey!=0 ){
123720 pH->count++;
123721 assert( pH->htsize>0 );
123722 assert( (pH->htsize & (pH->htsize-1))==0 );
123723 h = hraw & (pH->htsize-1);
123724 fts3HashInsertElement(pH, &pH->ht[h], new_elem);