home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
lclint.zip
/
lclint-2_3h-os2-bin.zip
/
test
/
list.c
< prev
next >
Wrap
C/C++ Source or Header
|
1997-09-03
|
618b
|
42 lines
typedef /*@null@*/ struct _list
{
/*@only@*/ char *this;
/*@null@*/ /*@only@*/ struct _list *next;
} *list;
extern /*@out@*/ /*@only@*/ void *
smalloc (size_t);
void
list_addh (/*@temp@*/ list l,
/*@only@*/ char *e)
{
if (l != NULL)
{
while (l->next != NULL)
{
l = l->next;
}
l->next = (list)
smalloc (sizeof (*l->next));
l->next->this = e;
}
}
void
list_addh2 (/*@temp@*/ list l,
/*@only@*/ char *e)
{
list new;
assert (l != NULL);
assert (l->next == NULL);
new = (list) smalloc (sizeof (*l->next));
new->this = e;
l->next = new;
}