-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfreelist.c
More file actions
44 lines (43 loc) · 897 Bytes
/
freelist.c
File metadata and controls
44 lines (43 loc) · 897 Bytes
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
#include "./include/headers.h"
void destroylist(struct commandnode** head)
{
struct commandnode * temp=(*head)->prev;
struct commandnode* prev;
while(temp!=*head)
{
prev=temp->prev;
free(temp);
temp=prev;
}
free(temp);
return;
}
void destroyRecordlist(struct recordOfCommands** head)
{
struct recordOfCommands * temp=(*head)->prev;
struct recordOfCommands* prev;
while(temp!=*head)
{
prev=temp->prev;
free(temp);
temp=prev;
}
free(temp);
return;
}
void removenodeFromRecordlist(struct recordOfCommands* node)
{
struct recordOfCommands* prev=node->prev;
struct recordOfCommands* next=node->next;
prev->next=next;
next->prev=prev;
free(node);
return;
}
void destroystringlist(char** list,int size)
{
for(int i=0;i<size;i++)
free(list[i]);
free(list);
return;
}