]>
Commit | Line | Data |
---|---|---|
885824d3 | 1 | typedef /*@null@*/ struct _list |
2 | { | |
3 | /*@only@*/ char *this; | |
4 | /*@null@*/ /*@only@*/ struct _list *next; | |
5 | } *list; | |
6 | ||
7 | extern /*@out@*/ /*@only@*/ void * | |
8 | smalloc (size_t); | |
9 | ||
10 | void | |
11 | list_addh (/*@temp@*/ list l, | |
12 | /*@only@*/ char *e) | |
13 | { | |
14 | if (l != NULL) | |
15 | { | |
16 | while (l->next != NULL) | |
17 | { | |
18 | l = l->next; | |
19 | } | |
20 | ||
21 | l->next = (list) | |
22 | smalloc (sizeof (*l->next)); | |
23 | l->next->this = e; | |
24 | } | |
3120b462 | 25 | } /* l->next->next not defined */ |
885824d3 | 26 | |
27 | void | |
28 | list_addh2 (/*@temp@*/ list l, | |
29 | /*@only@*/ char *e) | |
30 | { | |
31 | list new; | |
32 | ||
33 | assert (l != NULL); | |
34 | assert (l->next == NULL); | |
35 | ||
36 | new = (list) smalloc (sizeof (*l->next)); | |
37 | new->this = e; | |
38 | l->next = new; | |
3120b462 | 39 | } /* l->next->next not defined */ |
885824d3 | 40 | |
41 |