diff --git a/SAE2 b/SAE2 index 1aa55b7..2dc0b25 100755 Binary files a/SAE2 and b/SAE2 differ diff --git a/obj/charge.o b/obj/charge.o index 821b33e..145c5da 100644 Binary files a/obj/charge.o and b/obj/charge.o differ diff --git a/obj/main.o b/obj/main.o index 12067c4..ae18945 100644 Binary files a/obj/main.o and b/obj/main.o differ diff --git a/obj/structures.o b/obj/structures.o index da3e5a8..1d564cc 100644 Binary files a/obj/structures.o and b/obj/structures.o differ diff --git a/srcs/charge.c b/srcs/charge.c index 64da314..033acba 100644 --- a/srcs/charge.c +++ b/srcs/charge.c @@ -121,13 +121,13 @@ Precedence *loadPrec(int *tmax, int *tlog) prec=fopen("files/precedences.txt", "r"); (*tmax)=5; (*tlog)=0; - if (prec == NULL) + if (!prec) { printf("\033[0;31mErreur: \033[0mouverture de 'precedence.txt'\n"); exit(1); } tabP = (Precedence *)malloc((*tmax) * sizeof(Precedence)); - if (tabP == NULL) + if (!tabP) { printf("\033[0;31mErreur: \033[0mmalloc loadPrec\n"); exit(1); @@ -140,7 +140,7 @@ Precedence *loadPrec(int *tmax, int *tlog) { (*tmax)+=5; s = (Precedence *)realloc(tabP, (*tmax) * sizeof(Precedence)); - if (s==NULL) + if (!s) { printf("\033[0;31mErreur: \033[0mreallocation pour fichier précédence\n"); exit(1); @@ -169,8 +169,9 @@ Tache **loadTaches(Offre *tabTravaux[]) Precedence *prec; int i, tmaxPrec, tlogPrec; Tache *t, **tabTache; - tabTache = (Tache **)malloc(8*sizeof(Tache *)); - if (tabTache == NULL) + + tabTache = (Tache **)malloc(TMAXTRAV*sizeof(Tache *)); + if (!tabTache) { printf("\033[0;31mErreur: \033[0mmalloc tableau tache\n"); exit(1); @@ -178,7 +179,7 @@ Tache **loadTaches(Offre *tabTravaux[]) for (i=0; inxt=l->nxt; - l->nxt=ms; - strcpy(ms->tache, travaux); + ms = (MaillonSucc *)malloc(sizeof(MaillonSucc)); + if (ms == NULL) + { + printf("\033[0;31mErreur: \033[0mmalloc liste successeurs\n"); + exit(1); + } - return l; + ms->nxt = l; + l = ms; + strcpy(ms->tache, travaux); + + return l; } + //file void enfiler(ListeAttente *file, Tache *tache) {