/** * scoplib_scop_free function: * This function frees the allocated memory for a scoplib_scop_t structure. * \param scop The pointer to the scop we want to free. ** * - 30/04/2008: first version. */ void scoplib_scop_free(scoplib_scop_p scop) { int i; if (scop != NULL) { scoplib_matrix_free(scop->context); if (scop->parameters != NULL) { for (i = 0; i < scop->nb_parameters; i++) free(scop->parameters[i]); free(scop->parameters); } if (scop->arrays != NULL) { for (i = 0; i < scop->nb_arrays; i++) free(scop->arrays[i]); free(scop->arrays); } scoplib_statement_free(scop->statement); free(scop->optiontags); free(scop); } }
void ScopLib::freeStatement(scoplib_statement_p stmt) { if (stmt->read) scoplib_matrix_free(stmt->read); stmt->read = NULL; if (stmt->write) scoplib_matrix_free(stmt->write); stmt->write = NULL; scoplib_matrix_list_p current = stmt->domain; while (current) { scoplib_matrix_list_p next = current->next; current->next = NULL; scoplib_matrix_free(current->elt); current->elt = NULL; scoplib_matrix_list_free(current); current = next; } stmt->domain = NULL; if (stmt->schedule) scoplib_matrix_free(stmt->schedule); stmt->schedule = NULL; for (int i = 0; i < stmt->nb_iterators; ++i) free(stmt->iterators[i]); free(stmt->iterators); stmt->iterators = NULL; stmt->nb_iterators = 0; scoplib_statement_free(stmt); }