blob: dcd268ccbc1dfbba7f89d4c226f254c18bbabd56 (
plain)
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
|
/* For copyright information, see olden_v1.0/COPYRIGHT */
/********************************************************************
* List.c: Handles lists. *
* To be used with health.c *
******************************************************************* */
#include <stdio.h>
#include <stdlib.h>
#include "health.h"
#ifdef SS_PLAIN
#include "ssplain.h"
#endif SS_PLAIN
void addList(struct List *list, struct Patient *patient) {
struct List *b;
while (list != NULL)
{
b = list;
list = list->forward;
}
list = (struct List *)mymalloc(sizeof(struct List));
list->patient = patient;
list->forward = NULL;
list->back = b;
b->forward = list;
}
void removeList(struct List *list, struct Patient *patient)
{
struct List *l1,*l2;
struct Patient *p;
p = list->patient;
while(p != patient)
{
list = list->forward;
p = list->patient;
}
l1 = list->back;
l2 = list->forward;
l1->forward = l2;
if (list->forward != NULL)
{
l1 = list->forward;
l2 = list->back;
l1->back = l2;
}
}
|