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);
123374 SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){
123377 assert( pH!=0 );
123378 elem = pH->first;
123379 pH->first = 0;
123380 fts3HashFree(pH->ht);
123381 pH->ht = 0;
123382 pH->htsize = 0;
123385 if( pH->copyKey && elem->pKey ){
123391 pH->count = 0;
123467 Fts3Hash *pH, /* The complete hash table */
123477 else { pH->first = pNew; }
123480 pNew->next = pH->first;
123481 if( pH->first ){ pH->first->prev = pNew; }
123483 pH->first = pNew;
123496 static int fts3Rehash(Fts3Hash *pH, int new_size){
123504 fts3HashFree(pH->ht);
123505 pH->ht = new_ht;
123506 pH->htsize = new_size;
123507 xHash = ftsHashFunction(pH->keyClass);
123508 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
123511 fts3HashInsertElement(pH, &new_ht[h], elem);
123521 const Fts3Hash *pH, /* The pH to be searched */
123530 if( pH->ht ){
123531 struct _fts3ht *pEntry = &pH->ht[h];
123534 xCompare = ftsCompareFunction(pH->keyClass);
123549 Fts3Hash *pH, /* The pH containing "elem" */
123550 Fts3HashElem* elem, /* The element to be removed from the pH */
123557 pH->first = elem->next;
123562 pEntry = &pH->ht[h];
123570 if( pH->copyKey && elem->pKey ){
123574 pH->count--;
123575 if( pH->count<=0 ){
123576 assert( pH->first==0 );
123577 assert( pH->count==0 );
123578 fts3HashClear(pH);
123583 const Fts3Hash *pH,
123590 if( pH==0 || pH->ht==0 ) return 0;
123591 xHash = ftsHashFunction(pH->keyClass);
123594 assert( (pH->htsize & (pH->htsize-1))==0 );
123595 return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
123599 ** Attempt to locate an element of the hash table pH with a key
123603 SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){
123606 pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);
123610 /* Insert an element into the hash table pH. The key is pKey,nKey
123626 Fts3Hash *pH, /* The hash table to insert into */
123634 Fts3HashElem *new_elem; /* New element added to the pH */
123637 assert( pH!=0 );
123638 xHash = ftsHashFunction(pH->keyClass);
123641 assert( (pH->htsize & (pH->htsize-1))==0 );
123642 h = hraw & (pH->htsize-1);
123643 elem = fts3FindElementByHash(pH,pKey,nKey,h);
123647 fts3RemoveElementByHash(pH,elem,h);
123654 if( (pH->htsize==0 && fts3Rehash(pH,8))
123655 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
123657 pH->count = 0;
123660 assert( pH->htsize>0 );
123663 if( pH->copyKey && pKey!=0 ){
123674 pH->count++;
123675 assert( pH->htsize>0 );
123676 assert( (pH->htsize & (pH->htsize-1))==0 );
123677 h = hraw & (pH->htsize-1);
123678 fts3HashInsertElement(pH, &pH->ht[h], new_elem);