-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcleardata.c
63 lines (57 loc) · 1.3 KB
/
cleardata.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include "template.h"
void removeTransNode(TransNode **head) {
if (*head != NULL) {
TransNode *temp = *head;
*head = temp->next;
free(temp);
}
}
void cleanTransList(TransNode **head) {
printf("Cleaning the list.....");
while (*head != NULL) {
removeTransNode(head);
}
printf("Done\n");
}
void removeSellersNode(SellersList **head) {
SellersList *temp=*head;
if(temp!=NULL) {
*head=temp->next;
free(temp);
}
}
void cleanSellersList(SellersList **head) {
printf("Cleaning the list.....");
while(*head!=NULL) removeSellersNode(head);
printf("Done\n");
*head=NULL;
}
void clearSellerListNode(seller_buyer** sellerlisthead) {
seller_buyer* temp=*sellerlisthead;
TransNode **temp2;
if(temp!=NULL) {
temp2=&(temp->memberhead);
while(*temp2!=NULL) removeTransNode(temp2);
(*sellerlisthead)=temp->next;
free(temp);
}
}
void clearSellersList(seller_buyer** sellerlisthead) {
printf("Cleaning List.....");
while(*sellerlisthead!=NULL) {
clearSellerListNode(sellerlisthead);
}
printf("Done\n");
}
void clearPairs(Pair** pairhead) {
printf("Cleaning up the trash.....");
while(*pairhead!=NULL) {
Pair* ptr=*pairhead;
*pairhead=(*pairhead)->next;
free(ptr);
}
printf("Done\n");
}