/****************************************************************************
  Name          : mqa_client_queue_destroy
 
  Description   : This routine destroys the MQA queue tree.
 
  Arguments     : destroy_info - ptr to the destroy info
 
  Return Values : None
 
  Notes         : None
******************************************************************************/
static void mqa_queue_tree_destroy(MQA_CB *mqa_cb)
{
	uns32 rc = NCSCC_RC_SUCCESS;
	/* take the cb lock */
	if ((rc = (m_NCS_LOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE))) != NCSCC_RC_SUCCESS) {
		m_LOG_MQSV_A(MQA_QUEUE_TREE_DESTROY_FAILED, NCSFL_LC_MQSV_INIT, NCSFL_SEV_ERROR, rc, __FILE__,
			     __LINE__);
		return;
	}

	/* cleanup the client tree */
	mqa_queue_tree_cleanup(mqa_cb);

	/* destroy the tree */
	ncs_patricia_tree_destroy(&mqa_cb->mqa_queue_tree);

	/* giveup the cb lock */
	m_NCS_UNLOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE);

	return;
}
/****************************************************************************
  Name          : mqa_client_queue_destroy
 
  Description   : This routine destroys the MQA queue tree.
 
  Arguments     : destroy_info - ptr to the destroy info
 
  Return Values : None
 
  Notes         : None
******************************************************************************/
static void mqa_queue_tree_destroy(MQA_CB *mqa_cb)
{
	uint32_t rc = NCSCC_RC_SUCCESS;
	TRACE_ENTER();

	/* take the cb lock */
	if ((rc = (m_NCS_LOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE))) != NCSCC_RC_SUCCESS) {
		TRACE_2("Queue database Finalization Failed");
		return;
	}

	/* cleanup the client tree */
	mqa_queue_tree_cleanup(mqa_cb);

	/* destroy the tree */
	ncs_patricia_tree_destroy(&mqa_cb->mqa_queue_tree);

	/* giveup the cb lock */
	m_NCS_UNLOCK(&mqa_cb->cb_lock, NCS_LOCK_WRITE);

	TRACE_LEAVE();
	return;
}