Home | History | Annotate | Download | only in dist

Lines Matching refs:pH

21057 SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
21060 assert( pH!=0 );
21061 elem = pH->first;
21062 pH->first = 0;
21063 sqlite3_free(pH->ht);
21064 pH->ht = 0;
21065 pH->htsize = 0;
21071 pH->count = 0;
21088 /* Link pNew element into the hash table pH. If pEntry!=0 then also
21092 Hash *pH, /* The complete hash table */
21108 else { pH->first = pNew; }
21111 pNew->next = pH->first;
21112 if( pH->first ){ pH->first->prev = pNew; }
21114 pH->first = pNew;
21125 static int rehash(Hash *pH, unsigned int new_size){
21133 if( new_size==pH->htsize ) return 0;
21145 sqlite3_free(pH->ht);
21146 pH->ht = new_ht;
21147 pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht);
21149 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
21152 insertElement(pH, &new_ht[h], elem);
21162 const Hash *pH, /* The pH to be searched */
21170 if( pH->ht ){
21171 struct _ht *pEntry = &pH->ht[h];
21175 elem = pH->first;
21176 count = pH->count;
21191 Hash *pH, /* The pH containing "elem" */
21192 HashElem* elem, /* The element to be removed from the pH */
21199 pH->first = elem->next;
21204 if( pH->ht ){
21205 pEntry = &pH->ht[h];
21213 pH->count--;
21214 if( pH->count<=0 ){
21215 assert( pH->first==0 );
21216 assert( pH->count==0 );
21217 sqlite3HashClear(pH);
21221 /* Attempt to locate an element of the hash table pH
21225 SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){
21229 assert( pH!=0 );
21232 if( pH->ht ){
21233 h = strHash(pKey, nKey) % pH->htsize;
21237 elem = findElementGivenHash(pH, pKey, nKey, h);
21241 /* Insert an element into the hash table pH. The key is pKey,nKey
21255 SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){
21258 HashElem *new_elem; /* New element added to the pH */
21260 assert( pH!=0 );
21263 if( pH->htsize ){
21264 h = strHash(pKey, nKey) % pH->htsize;
21268 elem = findElementGivenHash(pH,pKey,nKey,h);
21272 removeElementGivenHash(pH,elem,h);
21286 pH->count++;
21287 if( pH->count>=10 && pH->count > 2*pH->htsize ){
21288 if( rehash(pH, pH->count*2) ){
21289 assert( pH->htsize>0 );
21290 h = strHash(pKey, nKey) % pH->htsize;
21293 if( pH->ht ){
21294 insertElement(pH, &pH->ht[h], new_elem);
21296 insertElement(pH, 0, new_elem);
112913 SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){
112916 assert( pH!=0 );
112917 elem = pH->first;
112918 pH->first = 0;
112919 fts3HashFree(pH->ht);
112920 pH->ht = 0;
112921 pH->htsize = 0;
112924 if( pH->copyKey && elem->pKey ){
112930 pH->count = 0;
113006 Fts3Hash *pH, /* The complete hash table */
113016 else { pH->first = pNew; }
113019 pNew->next = pH->first;
113020 if( pH->first ){ pH->first->prev = pNew; }
113022 pH->first = pNew;
113035 static int fts3Rehash(Fts3Hash *pH, int new_size){
113043 fts3HashFree(pH->ht);
113044 pH->ht = new_ht;
113045 pH->htsize = new_size;
113046 xHash = ftsHashFunction(pH->keyClass);
113047 for(elem=pH->first, pH->first=0; elem; elem = next_elem){
113050 fts3HashInsertElement(pH, &new_ht[h], elem);
113060 const Fts3Hash *pH, /* The pH to be searched */
113069 if( pH->ht ){
113070 struct _fts3ht *pEntry = &pH->ht[h];
113073 xCompare = ftsCompareFunction(pH->keyClass);
113088 Fts3Hash *pH, /* The pH containing "elem" */
113089 Fts3HashElem* elem, /* The element to be removed from the pH */
113096 pH->first = elem->next;
113101 pEntry = &pH->ht[h];
113109 if( pH->copyKey && elem->pKey ){
113113 pH->count--;
113114 if( pH->count<=0 ){
113115 assert( pH->first==0 );
113116 assert( pH->count==0 );
113117 fts3HashClear(pH);
113122 const Fts3Hash *pH,
113129 if( pH==0 || pH->ht==0 ) return 0;
113130 xHash = ftsHashFunction(pH->keyClass);
113133 assert( (pH->htsize & (pH->htsize-1))==0 );
113134 return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1));
113138 ** Attempt to locate an element of the hash table pH with a key
113142 SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){
113145 pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey);
113149 /* Insert an element into the hash table pH. The key is pKey,nKey
113165 Fts3Hash *pH, /* The hash table to insert into */
113173 Fts3HashElem *new_elem; /* New element added to the pH */
113176 assert( pH!=0 );
113177 xHash = ftsHashFunction(pH->keyClass);
113180 assert( (pH->htsize & (pH->htsize-1))==0 );
113181 h = hraw & (pH->htsize-1);
113182 elem = fts3FindElementByHash(pH,pKey,nKey,h);
113186 fts3RemoveElementByHash(pH,elem,h);
113193 if( (pH->htsize==0 && fts3Rehash(pH,8))
113194 || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2))
113196 pH->count = 0;
113199 assert( pH->htsize>0 );
113202 if( pH->copyKey && pKey!=0 ){
113213 pH->count++;
113214 assert( pH->htsize>0 );
113215 assert( (pH->htsize & (pH->htsize-1))==0 );
113216 h = hraw & (pH->htsize-1);
113217 fts3HashInsertElement(pH, &pH->ht[h], new_elem);