summaryrefslogtreecommitdiff
path: root/set_linked_lists.c
diff options
context:
space:
mode:
authorMendes Oulamara <oulamara@clipper.ens.fr>2013-12-04 17:26:39 +0100
committerMendes Oulamara <oulamara@clipper.ens.fr>2013-12-04 17:26:39 +0100
commitc0f025c2acc781573c14310a6cd543b397905695 (patch)
tree7950f45f801deb23a29685a37053339096a5c19c /set_linked_lists.c
parent765da0b81086f2c025258507c0ee27e3b3900dfb (diff)
parent71094b2d48ac784e60d454609064d20e83c017be (diff)
downloadAlgoProg-Projet-c0f025c2acc781573c14310a6cd543b397905695.tar.gz
AlgoProg-Projet-c0f025c2acc781573c14310a6cd543b397905695.zip
Merge branch 'master' of /users/13/info/oulamara/Work/../../auvolat/boulot/AlgoProg-Projet
Diffstat (limited to 'set_linked_lists.c')
-rw-r--r--set_linked_lists.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/set_linked_lists.c b/set_linked_lists.c
index e865b95..004e55a 100644
--- a/set_linked_lists.c
+++ b/set_linked_lists.c
@@ -9,6 +9,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include <assert.h>
+
#include "sets.h"
/* Question théorique pertinente :
@@ -92,6 +94,7 @@ set copy_set(const set s) {
for (iter = s->first->next; iter != NULL; iter = iter->next) {
element e = malloc(sizeof(struct set_elt));
+ assert(e != NULL);
e->value = iter->value;
prev->next = e;
prev = e;
@@ -236,7 +239,10 @@ bool sets_equal(const set a, const set b) {
int elt_of_set(const set s) {
if (s->first != NULL) return s->first->value;
- return -1; // should raise exception... hope this will be handled properly
+
+ fprintf(stderr, "No element in empty set...\n");
+ dump_set(s);
+ assert(false);
}
int elt_of_set_heur(const set s, int h) {