* CatCacheRemoveCList * * Unlink and delete the given cache list entry * * NB: any dead member entries that become unreferenced are deleted too. */
| 497 | * NB: any dead member entries that become unreferenced are deleted too. |
| 498 | */ |
| 499 | static void |
| 500 | CatCacheRemoveCList(CatCache *cache, CatCList *cl) |
| 501 | { |
| 502 | int i; |
| 503 | |
| 504 | Assert(cl->refcount == 0); |
| 505 | Assert(cl->my_cache == cache); |
| 506 | |
| 507 | /* delink from member tuples */ |
| 508 | for (i = cl->n_members; --i >= 0;) |
| 509 | { |
| 510 | CatCTup *ct = cl->members[i]; |
| 511 | |
| 512 | Assert(ct->c_list == cl); |
| 513 | ct->c_list = NULL; |
| 514 | /* if the member is dead and now has no references, remove it */ |
| 515 | if ( |
| 516 | #ifndef CATCACHE_FORCE_RELEASE |
| 517 | ct->dead && |
| 518 | #endif |
| 519 | ct->refcount == 0) |
| 520 | CatCacheRemoveCTup(cache, ct); |
| 521 | } |
| 522 | |
| 523 | /* delink from linked list */ |
| 524 | dlist_delete(&cl->cache_elem); |
| 525 | |
| 526 | /* free associated column data */ |
| 527 | CatCacheFreeKeys(cache->cc_tupdesc, cl->nkeys, |
| 528 | cache->cc_keyno, cl->keys); |
| 529 | |
| 530 | pfree(cl); |
| 531 | } |
| 532 | |
| 533 | |
| 534 | /* |
no test coverage detected