--- rpl/src/rplexternals.h 2013/04/01 15:29:39 1.49 +++ rpl/src/rplexternals.h 2013/04/02 11:56:33 1.50 @@ -1074,18 +1074,32 @@ #define removeObjectFromList(list, object) do { \ ifIsList(list) \ { \ - if ((*object).objet == NULL) \ + if ((*list).objet != NULL) \ { \ - struct_objet *__tmp_object; \ - if ((__tmp_object = copie_objet(list, 'N')) == NULL) \ - systemError("Memory allocation error"); \ - liberation(object); \ - object = __tmp_object; \ - \ - \ - \ - \ - } \ + struct_liste_chainee *__current; \ + struct_liste_chainee *__previous; \ + __current = (*list).objet; \ + __previous = NULL; \ + if ((*__current).donnee == object) \ + { \ + (*list).objet = (*__current).suivant; \ + } \ + else \ + { \ + while(__current != NULL) \ + { \ + if ((*__current).donnee == object) \ + { \ + (*__previous).suivant = (*__current).suivant; \ + break; \ + } \ + __previous = __current; \ + __current = (*__current).suivant; \ + } \ + } \ + liberation((*__current).donnee); \ + free(__current); \ + } \ } \ else executionError("Type mistmatch error"); } while(0)