|
32 | 32 | #define ARRAY_DEF(name, ...) \
|
33 | 33 | ARRAYI_DEF(M_IF_NARGS_EQ1(__VA_ARGS__) \
|
34 | 34 | ((name, __VA_ARGS__, M_GLOBAL_OPLIST_OR_DEF(__VA_ARGS__)(), M_C(name,_t), M_C(name,_it_t) ), \
|
35 |
| - (name, __VA_ARGS__, M_C(name,_t), M_C(name,_it_t)))) |
| 35 | + (name, __VA_ARGS__, M_C(name,_t), M_C(name,_it_t)))) |
36 | 36 |
|
37 | 37 | /* Define the oplist of a dynamic array given its name and its oplist.
|
38 | 38 | USAGE: ARRAY_OPLIST(name[, oplist of the type]) */
|
|
49 | 49 |
|
50 | 50 | /* OPLIST definition of a dynamic array */
|
51 | 51 | /* FIXME: Do we want to export some methods as they are slow and
|
52 |
| - are not fit to be used for building other methods (like _remove)? */ |
| 52 | + are not fit to be used for building other methods (like _it_remove)? */ |
53 | 53 | #define ARRAYI_OPLIST2(name, oplist) \
|
54 | 54 | (INIT(M_C(name, _init)) \
|
55 | 55 | ,INIT_SET(M_C(name, _init_set)) \
|
|
103 | 103 | ,M_IF_METHOD(DEL, oplist)(DEL(M_GET_DEL oplist),) \
|
104 | 104 | )
|
105 | 105 |
|
106 |
| -/* Define the contract of an array */ |
| 106 | +/* Define the internal contract of an array */ |
107 | 107 | #define ARRAYI_CONTRACT(a) do { \
|
108 | 108 | assert (a != NULL); \
|
109 | 109 | assert (a->size <= a->alloc); \
|
|
119 | 119 | typedef struct M_C(name, _s) { \
|
120 | 120 | size_t size; /* Number of elements in the array */ \
|
121 | 121 | size_t alloc; /* Allocated size for the array */ \
|
122 |
| - type *ptr; /* Pointer to the array */ \ |
| 122 | + type *ptr; /* Pointer to the array base */ \ |
123 | 123 | } array_t[1]; \
|
124 | 124 | typedef struct M_C(name, _s) *M_C(name, _ptr); \
|
125 | 125 | typedef const struct M_C(name, _s) *M_C(name, _srcptr); \
|
126 | 126 | \
|
127 | 127 | typedef type M_C(name, _type_t); \
|
128 | 128 | \
|
129 | 129 | typedef struct M_C(name, _it_s) { \
|
130 |
| - size_t index; \ |
131 |
| - const struct M_C(name, _s) *array; \ |
| 130 | + size_t index; /* Index of the element */ \ |
| 131 | + const struct M_C(name, _s) *array; /* Reference of the array */ \ |
132 | 132 | } array_it_t[1]; \
|
133 | 133 | \
|
134 | 134 | static inline void \
|
|
0 commit comments