FreeBASIC
0.91.0
Main Page
Data Structures
Files
File List
Globals
listdyn.c
Go to the documentation of this file.
1
/* generic internal dynamic lists */
2
3
#include "
fb.h
"
4
12
void
fb_hListDynInit
(
FB_LIST
*
list
)
13
{
14
memset(list, 0,
sizeof
(
FB_LIST
));
15
}
16
25
void
fb_hListDynElemAdd
(
FB_LIST
*
list
,
FB_LISTELEM
*elem )
26
{
27
if
( list->
tail
!=
NULL
)
28
list->
tail
->
next
= elem;
29
else
30
list->
head
= elem;
31
32
elem->
prev
= list->
tail
;
33
elem->
next
=
NULL
;
34
35
list->
tail
= elem;
36
37
++list->
cnt
;
38
}
39
48
void
fb_hListDynElemRemove
(
FB_LIST
*
list
,
FB_LISTELEM
*elem )
49
{
50
/* del from used list */
51
if
( elem->
prev
!=
NULL
)
52
elem->
prev
->
next
= elem->
next
;
53
else
54
list->
head
= elem->
next
;
55
56
if
( elem->
next
!=
NULL
)
57
elem->
next
->
prev
= elem->
prev
;
58
else
59
list->
tail
= elem->
prev
;
60
61
/* reset element pointers */
62
elem->
prev
= elem->
next
=
NULL
;
63
64
/* don't forget to change the number of elements in the list */
65
--list->
cnt
;
66
}
rtlib
listdyn.c
Generated on Thu Jan 23 2014 19:40:12 for FreeBASIC by
1.8.4