Skip to content
This repository was archived by the owner on Apr 13, 2019. It is now read-only.

Commit 79066c0

Browse files
Glenn ScottGlenn Scott
authored andcommitted
Updated to use the new PARCObjectDescriptor
1 parent b51bbe3 commit 79066c0

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

ccnx/forwarder/metis/content_store/metis_LRUContentStore.c

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ typedef struct metis_lru_contentstore_data {
8787
} _MetisLRUContentStore;
8888

8989

90+
9091
static void
9192
_destroyIndexes(_MetisLRUContentStore *store)
9293
{
@@ -117,16 +118,31 @@ _destroyIndexes(_MetisLRUContentStore *store)
117118
}
118119

119120
static void
120-
_destroy(MetisContentStoreInterface **storeImplPtr)
121+
_MetisContentStoreInterface_Destroy(MetisContentStoreInterface **storeImplPtr)
121122
{
122123
_MetisLRUContentStore *store = metisContentStoreInterface_GetPrivateData(*storeImplPtr);
123124

124-
_destroyIndexes(store);
125+
// _destroyIndexes(store);
126+
parcObject_Release((PARCObject **) &store);
127+
}
125128

129+
static bool
130+
_MetisLRUContentStore_Destructor(_MetisLRUContentStore **storePtr)
131+
{
132+
_MetisLRUContentStore *store = *storePtr;
133+
134+
_destroyIndexes(store);
126135
metisLogger_Release(&store->logger);
136+
137+
return true;
127138
}
128139

129-
parcObject_ExtendPARCObject(MetisContentStoreInterface, _destroy, NULL, NULL, NULL, NULL, NULL, NULL);
140+
parcObject_Override(_MetisLRUContentStore, PARCObject,
141+
.destructor = (PARCObjectDestructor *) _MetisLRUContentStore_Destructor
142+
);
143+
144+
parcObject_ExtendPARCObject(MetisContentStoreInterface,
145+
_MetisContentStoreInterface_Destroy, NULL, NULL, NULL, NULL, NULL, NULL);
130146

131147
static parcObject_ImplementAcquire(_metisLRUContentStore, MetisContentStoreInterface);
132148
static parcObject_ImplementRelease(_metisLRUContentStore, MetisContentStoreInterface);
@@ -499,12 +515,14 @@ metisLRUContentStore_Create(MetisContentStoreConfig *config, MetisLogger *logger
499515

500516
assertNotNull(logger, "MetisLRUContentStore requires a non-NULL logger");
501517

502-
size_t allocationSize = sizeof(MetisContentStoreInterface) + sizeof(_MetisLRUContentStore);
518+
// size_t allocationSize = sizeof(MetisContentStoreInterface) + sizeof(_MetisLRUContentStore);
503519

504-
storeImpl = parcObject_CreateAndClearInstanceImpl(allocationSize, &parcObject_MetaName(MetisContentStoreInterface));
520+
// storeImpl = parcObject_CreateAndClearInstanceImpl(allocationSize, &parcObject_MetaName(MetisContentStoreInterface));
521+
storeImpl = parcObject_CreateAndClearInstance(MetisContentStoreInterface);
505522

506523
if (storeImpl != NULL) {
507-
storeImpl->_privateData = (uint8_t *) storeImpl + sizeof(MetisContentStoreInterface);
524+
// storeImpl->_privateData = (uint8_t *) storeImpl + sizeof(MetisContentStoreInterface);
525+
storeImpl->_privateData = parcObject_CreateAndClearInstance(_MetisLRUContentStore);
508526

509527
if (_metisLRUContentStore_Init(storeImpl->_privateData, config, logger)) {
510528
storeImpl->putContent = &_metisLRUContentStore_PutContent;

0 commit comments

Comments
 (0)