zabbix-agent2/src/libs/zbxdbcache/dbsync.c
/******************************************************************************
 *                                                                            *
 * Function: zbx_dbsync_clear                                                 *
 *                                                                            *
 * Purpose: frees resources allocated by changeset                            *
 *                                                                            *
 ******************************************************************************/
zbx_dbsync_clear

Purpose: frees resources allocated by changeset
zbx_dbsync_clear Purpose : frees resources allocated by changeset
void	zbx_dbsync_clear(zbx_dbsync_t *sync)
{
	zbx_vector_ptr_clear_ext(&sync->columns, zbx_ptr_free);
	zbx_vector_ptr_destroy(&sync->columns);
	zbx_free(sync->row);
	if (ZBX_DBSYNC_UPDATE == sync->mode)
	{
		int			i, j;
		zbx_dbsync_row_t	*row;
		for (i = 0; i < sync->rows.values_num; i++)
		{
			row = (zbx_dbsync_row_t *)sync->rows.values[i];
			if (NULL != row->row)
			{
				for (j = 0; j < sync->columns_num; j++)
					dbsync_strfree(row->row[j]);
				zbx_free(row->row);
			}
			zbx_free(row);
		}
		zbx_vector_ptr_destroy(&sync->rows);
	}
	else
	{
		DBfree_result(sync->dbresult);
		sync->dbresult = NULL;
	}
}
void zbx_dbsync_clear ( zbx_dbsync_t * sync ) { zbx_vector_ptr_clear_ext ( & sync -> columns , zbx_ptr_free ) ; zbx_vector_ptr_destroy ( & sync -> columns ) ; zbx_free ( sync -> row ) ; if ( ZBX_DBSYNC_UPDATE == sync -> mode ) { int i , j ; zbx_dbsync_row_t * row ; for ( i = 0 ; i < sync -> rows . values_num ; i ++ ) { row = ( zbx_dbsync_row_t * ) sync -> rows . values [ i ] ; if ( NULL != row -> row ) { for ( j = 0 ; j < sync -> columns_num ; j ++ ) dbsync_strfree ( row -> row [ j ] ) ; zbx_free ( row -> row ) ; } zbx_free ( row ) ; } zbx_vector_ptr_destroy ( & sync -> rows ) ; } else { DBfree_result ( sync -> dbresult ) ; sync -> dbresult = NULL ; } }
Function: zbx_dbsync_clear                                                 
                                                                            
 Purpose: frees resources allocated by changeset
Function : zbx_dbsync_clear Purpose : frees resources allocated by changeset
/* free the resources allocated by row pre-processing */