コード例 #1
0
ファイル: item.cpp プロジェクト: edubart/otserv
ItemAttributes::~ItemAttributes()
{
	if (m_firstAttr)
	{
		deleteAttrs(m_firstAttr);
	}
}
コード例 #2
0
ファイル: item.cpp プロジェクト: HeberPcL/forgottenserver
void ItemAttributes::deleteAttrs(Attribute* attr)
{
	if (attr) {
		if (validateStrAttrType(attr->type)) {
			delete (std::string*)attr->value;
		}

		Attribute* next_attr = attr->next;
		attr->next = NULL;

		if (next_attr) {
			deleteAttrs(next_attr);
		}

		delete attr;
	}
}
コード例 #3
0
ファイル: item.cpp プロジェクト: TwistedScorpio/OTHire
void ItemAttributes::deleteAttrs(Attribute* attr)
{
	//deletes all attributes recursively
	if(attr){
		//if is string type, delete the allocated string
		if(validateStrAttrType(attr->type)){
			delete (std::string*)attr->value;
		}
		Attribute* next_attr = attr->next;
		attr->next = NULL;
		//delete next while it was not NULL
		if(next_attr){
			deleteAttrs(next_attr);
		}
		delete attr;
	}
}