void RecursiveDestroy (TreeNode *p) { if(p == NULL) return; RecursiveDestroy(p->left); RecursiveDestroy(p->right); /*free the value of the node, then the node itself*/ destroyValue(p->value); free(p); }
void xmlrpc_DECREF (xmlrpc_value * const valueP) { XMLRPC_ASSERT_VALUE_OK(valueP); XMLRPC_ASSERT(valueP->_refcount > 0); XMLRPC_ASSERT(valueP->_type != XMLRPC_TYPE_DEAD); valueP->_refcount--; /* If we have no more refs, we need to deallocate this value. */ if (valueP->_refcount == 0) destroyValue(valueP); }
void copyAssign(const OptionalImplBase<T>& other) { if (other.m_hasValue) { if (m_hasValue) { *ptr() = *other.ptr(); } else { new (ptr()) T{*other.ptr()}; } } else { destroyValue(); } m_hasValue = other.m_hasValue; }
void moveAssign(OptionalImplBase<T>&& other) { if (other.m_hasValue) { if (m_hasValue) { *ptr() = std::move(*other.ptr()); } else { new (ptr()) T{std::move(*other.ptr())}; } other.destroyValue(); } else { destroyValue(); } m_hasValue = other.m_hasValue; }
T release() { auto tmp = std::move(value()); destroyValue(); return tmp; }
/** * @brief Destructor. */ ~OptionalImplBase() { destroyValue(); }
void copyAssign(const T& obj) { destroyValue(); new (ptr()) T{obj}; m_hasValue = true; }
void moveAssign(T&& obj) { destroyValue(); new (ptr()) T{std::forward<T>(obj)}; m_hasValue = true; }
ElementProperty::~ElementProperty() { destroyValue(type, defValue); }
DataValue::~DataValue() { destroyValue(type, value); }