ajout commentaire suprimerElemListeArticle

This commit is contained in:
adriy 2017-05-12 12:59:33 +00:00
parent 044fef6af0
commit 5c55c3e483
1 changed files with 3 additions and 3 deletions

View File

@ -1080,19 +1080,19 @@ void suprimerElemListeArticle(ListeArticle ** listeArticle)
{ {
ListeArticle * aSup = rechercheElemListe(*listeArticle); ListeArticle * aSup = rechercheElemListe(*listeArticle);
ListeArticle * tmp = *listeArticle; ListeArticle * tmp = *listeArticle;
if(aSup->suite) if(aSup->suite)//Elem au millieux ou premier mais il y a ye suite
{ {
ListeArticle * aFree = aSup->suite; ListeArticle * aFree = aSup->suite;
memcpy(aSup, aSup->suite, sizeof(ListeArticle)); memcpy(aSup, aSup->suite, sizeof(ListeArticle));
free(aFree); free(aFree);
aFree = NULL; aFree = NULL;
} }
else if(aSup == *listeArticle) else if(aSup == *listeArticle)//Premier et pas de suite
{ {
free(*listeArticle); free(*listeArticle);
*listeArticle = NULL; *listeArticle = NULL;
} }
else else//Pas de suite, recherche precdent pour que precdent->suite = NULL
{ {
for(;tmp->suite != aSup && tmp;tmp = tmp->suite); for(;tmp->suite != aSup && tmp;tmp = tmp->suite);
if(tmp){ if(tmp){