Exemple #1
0
void opcode_chain_delete(opcode_chain_t oc) {
	if(list_not_empty(oc)) {
		opcode_chain_apply(oc,opcode_chain_node_free);
		slist_flush(oc);
	}
	free(oc);
}
Exemple #2
0
/* Compare two list */
int list_compare(List *list1, List *list2) {
	int diff;
	if (list_is_empty(list1) && list_is_empty(list2)) {
		diff = 0;
	} else if (list_is_empty(list1) && list_not_empty(list2)) {
		diff = -1;
	} else if (list_not_empty(list1) && list_is_empty(list2)) {
		diff = 1;
	} else {
		diff = 0;
		Node *first = list1->head;
		Node *second = list2->head;
		while (first && second && diff == 0) {
			diff = list1->compare(first->data, second->data);

			first = first->next;
			second = second->next;
		}
	}

	return diff;
}