1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-14 18:42:34 +03:00

Remove unnecessary "head" arguments from some dlist/slist functions.

dlist_delete, dlist_insert_after, dlist_insert_before, slist_insert_after
do not need access to the list header, and indeed insisting on that negates
one of the main advantages of a doubly-linked list.

In consequence, revert addition of "cache_bucket" field to CatCTup.
This commit is contained in:
Tom Lane
2012-10-18 19:04:20 -04:00
parent 8f8d746478
commit dc5aeca168
5 changed files with 27 additions and 48 deletions

View File

@ -370,7 +370,7 @@ CatCacheRemoveCTup(CatCache *cache, CatCTup *ct)
return; /* nothing left to do */
}
dlist_delete(ct->cache_bucket, &ct->cache_elem);
dlist_delete(&ct->cache_elem);
/* free associated tuple data */
if (ct->tuple.t_data != NULL)
@ -413,7 +413,7 @@ CatCacheRemoveCList(CatCache *cache, CatCList *cl)
}
/* delink from linked list */
dlist_delete(&cache->cc_lists, &cl->cache_elem);
dlist_delete(&cl->cache_elem);
/* free associated tuple data */
if (cl->tuple.t_data != NULL)
@ -1664,15 +1664,13 @@ CatalogCacheCreateEntry(CatCache *cache, HeapTuple ntp,
*/
ct->ct_magic = CT_MAGIC;
ct->my_cache = cache;
ct->cache_bucket = &cache->cc_bucket[hashIndex];
ct->c_list = NULL;
ct->refcount = 0; /* for the moment */
ct->dead = false;
ct->negative = negative;
ct->hash_value = hashValue;
dlist_push_head(ct->cache_bucket, &ct->cache_elem);
dlist_push_head(&cache->cc_bucket[hashIndex], &ct->cache_elem);
cache->cc_ntup++;
CacheHdr->ch_ntup++;