static CMPIStatus release(CMPIConstClass * cc) { CMPIStatus rc = { 0, NULL }; if (cc->refCount == 0) { if (cc->hdl) { if (cc->hdl != (void *) (cc + 1)) ClClassFreeClass(cc->hdl); } free(cc); } return rc; }
static CMPIStatus addClass(ClassRegister * cr, CMPIConstClass * ccp, char *cn, char *p) { CMPIStatus st = { CMPI_RC_OK, NULL }; ClassBase *cb = (ClassBase *) (cr + 1); UtilHashTable *it = cb->it; UtilList *ul; char *pn = p; CMPIConstClass *cc = ccp; ClClass *mc; if (p) { mc = ClClassNew(cn, p); st = mergeParents(cr, mc, pn, ccp); if (st.rc != CMPI_RC_OK) { ClClassFreeClass(mc); return st; } ccp->hdl = mc; } cc = ccp->ft->clone(ccp, NULL); mc = (ClClass *) cc->hdl; cb->ht->ft->put(cb->ht, strdup(cn), cc); if (cc->ft->isAssociation(cc)) { cr->assocs++; if (p == NULL) cr->topAssocs++; } if (p) { ul = it->ft->get(it, p); if (ul == NULL) { ul = UtilFactory->newList(NULL, memUnlinkEncObj); it->ft->put(it, p, ul); } ul->ft->prepend(ul, cn); } return st; }