Thread
-
Minor refactor in catcache.c
cca5507 <cca5507@qq.com> — 2025-12-30T11:48:44Z
Hi, ``` @@ -1010,7 +1010,7 @@ RehashCatCache(CatCache *cp) dlist_foreach_modify(iter, &cp->cc_bucket[i]) { CatCTup *ct = dlist_container(CatCTup, cache_elem, iter.cur); - int hashIndex = HASH_INDEX(ct->hash_value, newnbuckets); + Index hashIndex = HASH_INDEX(ct->hash_value, newnbuckets); dlist_delete(iter.cur); dlist_push_head(&newbucket[hashIndex], &ct->cache_elem); @@ -1048,7 +1048,7 @@ RehashCatCacheLists(CatCache *cp) dlist_foreach_modify(iter, &cp->cc_lbucket[i]) { CatCList *cl = dlist_container(CatCList, cache_elem, iter.cur); - int hashIndex = HASH_INDEX(cl->hash_value, newnbuckets); + Index hashIndex = HASH_INDEX(cl->hash_value, newnbuckets); dlist_delete(iter.cur); dlist_push_head(&newbucket[hashIndex], &cl->cache_elem); ``` The 'hashIndex' should be 'Index' rather than 'int'. ``` @@ -2039,8 +2039,7 @@ SearchCatCacheList(CatCache *cache, #ifndef CATCACHE_FORCE_RELEASE ct->dead && #endif - ct->refcount == 0 && - (ct->c_list == NULL || ct->c_list->refcount == 0)) + ct->refcount == 0) CatCacheRemoveCTup(cache, ct); } ``` Remove the dead code because we have a 'Assert(ct->c_list == NULL);'. -- Regards, ChangAo Chen