This commit is contained in:
Lukian LEIZOUR 2023-11-30 15:59:10 +01:00
parent a70b104817
commit 36319a7b7f
8 changed files with 207 additions and 153 deletions

10
conf.c
View file

@ -91,6 +91,7 @@ ptListener newListenerChain() {
listenerChain -> prev = NULL;
listenerChain -> next = (ptListener) malloc(sizeof(tListener));
listenerChain -> next -> prev = listenerChain;
listenerChain -> next -> next = NULL;
listenerChain -> id = -1;
return listenerChain;
@ -159,20 +160,15 @@ void addConfToConfList(ptConfList confList, ptConf conf, int grade) {
void removeConfFromConfList(ptConfList confList, ptConf conf) {
ptConfList px = confList;
while (px -> next != NULL && px -> conf != conf) {
while (px -> next != NULL && px -> next -> conf != conf) {
px = px -> next;
}
printConfList(confList -> next);
printf("%d\n", px -> conf -> id);
if (px -> next != NULL && px -> next -> conf == conf) {
ptConfList tmp = px -> next -> next;
free(px -> next);
px -> next = tmp;
}
system("pause");
}
void printConfList(ptConfList confList) {
@ -202,7 +198,7 @@ void addListenerToListenerList(ptListenerList listenerList, ptListener listener,
void removeListenerFromListenerList(ptListenerList listenerList, ptListener listener) {
ptListenerList px = listenerList;
while (px -> next != NULL && px -> listener != listener) {
while (px -> next != NULL && px -> next -> listener != listener) {
px = px -> next;
}