/** * xmlSecKeyDataStoreDestroy: * @store: the pointer to the key data store.. * * Destroys the key data store created with #xmlSecKeyDataStoreCreate * function. */ void xmlSecKeyDataStoreDestroy(xmlSecKeyDataStorePtr store) { xmlSecAssert(xmlSecKeyDataStoreIsValid(store)); xmlSecAssert(store->id->objSize > 0); if(store->id->finalize != NULL) { (store->id->finalize)(store); } memset(store, 0, store->id->objSize); xmlFree(store); }
/** * xmlSecKeysMngrAdoptDataStore: * @mngr: the pointer to keys manager. * @store: the pointer to data store. * * Adopts data store in the keys manager. * * Returns 0 on success or a negative value if an error occurs. */ int xmlSecKeysMngrAdoptDataStore(xmlSecKeysMngrPtr mngr, xmlSecKeyDataStorePtr store) { xmlSecKeyDataStorePtr tmp; xmlSecSize pos, size; xmlSecAssert2(mngr != NULL, -1); xmlSecAssert2(xmlSecKeyDataStoreIsValid(store), -1); size = xmlSecPtrListGetSize(&(mngr->storesList)); for(pos = 0; pos < size; ++pos) { tmp = (xmlSecKeyDataStorePtr)xmlSecPtrListGetItem(&(mngr->storesList), pos); if((tmp != NULL) && (tmp->id == store->id)) { return(xmlSecPtrListSet(&(mngr->storesList), store, pos)); } } return(xmlSecPtrListAdd(&(mngr->storesList), store)); }