Dillo v3.1.1-111-gd4f56d0d
Loading...
Searching...
No Matches
list.h
Go to the documentation of this file.
1
8#ifndef __LIST_H__
9#define __LIST_H__
10
16#define a_List_resize(list,num_items,alloc_step) \
17 if (!list) { \
18 list = dMalloc(alloc_step * sizeof(*list)); \
19 } \
20 if (num_items >= alloc_step){ \
21 while ( num_items >= alloc_step ) \
22 alloc_step <<= 1; \
23 list = dRealloc(list, alloc_step * sizeof(*list)); \
24 }
25
26
30#define a_List_add(list,num_items,alloc_step) \
31 a_List_resize(list,num_items,alloc_step)
32
33
38#define a_List_remove(list, item, num_items) \
39 if (list && item < num_items) { \
40 list[item] = list[--num_items]; \
41 }
42
43
44#endif /* __LIST_H__ */