Home | History | Annotate | Download | only in dist

Lines Matching refs:pH

21050 SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
21053 assert( pH!=0 );
21054 elem = pH->first;
21055 pH->first = 0;
21056 sqlite3_free(pH->ht);
21057 pH->ht = 0;
21058 pH->htsize = 0;
21064 pH->count = 0;
21081 /* Link pNew element into the hash table pH. If pEntry!=0 then also
21085 Hash *pH, /* The complete hash table */
21101 else { pH->first = pNew; }
21104 pNew->next = pH->first;
21105 if( pH->first ){ pH->first->prev = pNew; }
21107 pH->first = pNew;
21118 static int rehash(Hash *pH, unsigned int new_size){
21126 if( new_size==pH->htsize ) return 0;
21138 sqlite3_free(pH->ht);
21139 pH->ht = new_ht;
21140 pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
21142 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
21145 insertElement(pH, &new_ht[h], elem);
21155 const Hash *pH, /* The pH to be searched */
21163 if( pH->ht ){
21164 struct _ht *pEntry = &pH->ht[h];
21168 elem = pH->first;
21169 count = pH->count;
21184 Hash *pH, /* The pH containing "elem" */
21185 HashElem* elem, /* The element to be removed from the pH */
21192 pH->first = elem->next;
21197 if( pH->ht ){
21198 pEntry = &pH->ht[h];
21206 pH->count--;
21207 if( pH->count<=0 ){
21208 assert( pH->first==0 );
21209 assert( pH->count==0 );
21210 sqlite3HashClear(pH);
21214 /* Attempt to locate an element of the hash table pH with a key
21218 SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){
21222 assert( pH!=0 );
21225 if( pH->ht ){
21226 h = strHash(pKey, nKey) % pH->htsize;
21230 elem = findElementGivenHash(pH, pKey, nKey, h);
21234 /* Insert an element into the hash table pH. The key is pKey,nKey
21248 SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){
21251 HashElem *new_elem; /* New element added to the pH */
21253 assert( pH!=0 );
21256 if( pH->htsize ){
21257 h = strHash(pKey, nKey) % pH->htsize;
21261 elem = findElementGivenHash(pH,pKey,nKey,h);
21265 removeElementGivenHash(pH,elem,h);
21279 pH->count++;
21280 if( pH->count>=10 && pH->count > 2*pH->htsize ){
21281 if( rehash(pH, pH->count*2) ){
21282 assert( pH->htsize>0 );
21283 h = strHash(pKey, nKey) % pH->htsize;
21286 if( pH->ht ){
21287 insertElement(pH, &pH->ht[h], new_elem);
21289 insertElement(pH, 0, new_elem);
112882 SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){
112885 assert( pH!=0 );
112886 elem = pH->first;
112887 pH->first = 0;
112888 fts3HashFree(pH->ht);
112889 pH->ht = 0;
112890 pH->htsize = 0;
112893 if( pH->copyKey && elem->pKey ){
112899 pH->count = 0;
112975 Fts3Hash *pH, /* The complete hash table */
112985 else { pH->first = pNew; }
112988 pNew->next = pH->first;
112989 if( pH->first ){ pH->first->prev = pNew; }
112991 pH->first = pNew;
113004 static int fts3Rehash(Fts3Hash *pH, int new_size){
113012 fts3HashFree(pH->ht);
113013 pH->ht = new_ht;
113014 pH->htsize = new_size;
113015 xHash = ftsHashFunction(pH->keyClass);
113016 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
113019 fts3HashInsertElement(pH, &new_ht[h], elem);
113029 const Fts3Hash *pH, /* The pH to be searched */
113038 if( pH->ht ){
113039 struct _fts3ht *pEntry = &pH->ht[h];
113042 xCompare = ftsCompareFunction(pH->keyClass);
113057 Fts3Hash *pH, /* The pH containing "elem" */
113058 Fts3HashElem* elem, /* The element to be removed from the pH */
113065 pH->first = elem->next;
113070 pEntry = &pH->ht[h];
113078 if( pH->copyKey && elem->pKey ){
113082 pH->count--;
113083 if( pH->count<=0 ){
113084 assert( pH->first==0 );
113085 assert( pH->count==0 );
113086 fts3HashClear(pH);
113091 const Fts3Hash *pH,
113098 if( pH==0 || pH->ht==0 ) return 0;
113099 xHash = ftsHashFunction(pH->keyClass);
113102 assert( (pH->htsize & (pH->htsize-1))==0 );
113103 return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
113107 ** Attempt to locate an element of the hash table pH with a key
113111 SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){
113114 pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);
113118 /* Insert an element into the hash table pH. The key is pKey,nKey
113134 Fts3Hash *pH, /* The hash table to insert into */
113142 Fts3HashElem *new_elem; /* New element added to the pH */
113145 assert( pH!=0 );
113146 xHash = ftsHashFunction(pH->keyClass);
113149 assert( (pH->htsize & (pH->htsize-1))==0 );
113150 h = hraw & (pH->htsize-1);
113151 elem = fts3FindElementByHash(pH,pKey,nKey,h);
113155 fts3RemoveElementByHash(pH,elem,h);
113162 if( (pH->htsize==0 && fts3Rehash(pH,8))
113163 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
113165 pH->count = 0;
113168 assert( pH->htsize>0 );
113171 if( pH->copyKey && pKey!=0 ){
113182 pH->count++;
113183 assert( pH->htsize>0 );
113184 assert( (pH->htsize & (pH->htsize-1))==0 );
113185 h = hraw & (pH->htsize-1);
113186 fts3HashInsertElement(pH, &pH->ht[h], new_elem);