cElement::~cElement() { freeAttributes(); freeChildren(); if ( parent_ ) parent_->removeChild( this ); }
void cElement::copyAttributes( const QXmlAttributes& attributes ) { freeAttributes(); attrCount_ = attributes.count(); if ( attrCount_ > 0 ) { this->attributes = new stAttribute * [attrCount_]; for ( unsigned int i = 0; i < attrCount_; ++i ) { this->attributes[i] = new stAttribute; this->attributes[i]->name = attributes.localName( i ); this->attributes[i]->value = attributes.value( i ); } } }
void freeOCnode(OCnode* cdf, int deep) { unsigned int i; if(cdf == NULL) return; if(cdf->name != NULL) free(cdf->name); if(cdf->fullname != NULL) free(cdf->fullname); if(cdf->attributes != NULL) freeAttributes(cdf->attributes); if(cdf->subnodes != NULL) { if(deep) { for(i=0;i<oclistlength(cdf->subnodes);i++) { OCnode* node = (OCnode*)oclistget(cdf->subnodes,i); freeOCnode(node,deep); } } oclistfree(cdf->subnodes); } free(cdf); }
PTErr_t PTCheckIn ( PTRefNum_p PTRefNumP, PTAddr_t PTAddr) { PTErr_t errnum; KpFd_t fd; KpHandle_t PTHdr = NULL, PTAttr = NULL; #if !defined KCP_ICC_ONLY fut_hdr_t FAR *futp; #endif PTType_t format; /* Check for valid PTRefNumP */ if (PTRefNumP == NULL) { errnum = KCP_BAD_PTR; goto ErrOut4; } /* initialize memory file manager to read the PT */ if (KpOpen (NULL, "m", &fd, NULL, (KpGenericPtr_t)PTAddr, PTCHECKINSIZE) != KCMS_IO_SUCCESS) { errnum = KCP_SYSERR_1; goto ErrOut4; } /* read the header info */ errnum = TpReadHdr (&fd, &PTHdr, &format); if (errnum != KCP_SUCCESS) { goto ErrOut1; } #if !defined KCP_ICC_ONLY switch (format) { case PTTYPE_FUTF: /* discard the attribute info */ futp = lockBuffer (PTHdr); /* get the attributes */ errnum = readAttributes (&fd, futp->idstr_len, &PTAttr); unlockBuffer (PTHdr); if (errnum != KCP_SUCCESS) { goto ErrOut2; } if (PTMemTest () == 0) { /* not enough memory to continue */ errnum = KCP_NO_CHECKIN_MEM; goto ErrOut3; } break; default: break; } #endif errnum = registerPT (PTHdr, PTAttr, PTRefNumP); /* enter PT into list */ if (errnum != KCP_SUCCESS) { #if !defined KCP_ICC_ONLY ErrOut3: #endif (void) freeAttributes(PTAttr); /* free the attributes */ freeBuffer (PTAttr); #if !defined KCP_ICC_ONLY ErrOut2: #endif (void) TpFreeHdr (PTHdr); /* free the header */ } ErrOut1: (void) Kp_close (&fd); ErrOut4: return (errnum); }