Update comments
This commit is contained in:
1 parent
8c0b6f1e9d
commit
91c74b863d
1 file changed
+4
-4
@@ -106,8 +106,9 @@
|
|||||||
#define ARRAYI_DEF2(name, type, oplist, array_t, array_it_t) \
|
#define ARRAYI_DEF2(name, type, oplist, array_t, array_it_t) \
|
||||||
\
|
\
|
||||||
typedef struct M_C(name, _s) { \
|
typedef struct M_C(name, _s) { \
|
||||||
size_t size, alloc; \
|
size_t size; /* Number of elements in the array */ \
|
||||||
type *ptr; \
|
size_t alloc; /* Allocated size for the array */ \
|
||||||
|
type *ptr; /* Pointer to the array */ \
|
||||||
} array_t[1]; \
|
} array_t[1]; \
|
||||||
typedef struct M_C(name, _s) *M_C(name, _ptr); \
|
typedef struct M_C(name, _s) *M_C(name, _ptr); \
|
||||||
typedef const struct M_C(name, _s) *M_C(name, _srcptr); \
|
typedef const struct M_C(name, _s) *M_C(name, _srcptr); \
|
||||||
@@ -123,6 +124,7 @@
|
|||||||
M_C(name, _init)(array_t v) \
|
M_C(name, _init)(array_t v) \
|
||||||
{ \
|
{ \
|
||||||
assert (v != NULL); \
|
assert (v != NULL); \
|
||||||
|
/* Initialy, the array is empty with nothing allocated */ \
|
||||||
v->size = 0; \
|
v->size = 0; \
|
||||||
v->alloc = 0; \
|
v->alloc = 0; \
|
||||||
v->ptr = NULL; \
|
v->ptr = NULL; \
|
||||||
@@ -145,8 +147,6 @@
|
|||||||
ARRAYI_CONTRACT(v); \
|
ARRAYI_CONTRACT(v); \
|
||||||
M_C(name, _clean)(v); \
|
M_C(name, _clean)(v); \
|
||||||
M_GET_FREE oplist(v->ptr); \
|
M_GET_FREE oplist(v->ptr); \
|
||||||
/* Don't reset size to 0 to keep a field out of range so that it \
|
|
||||||
can be detected by an assertion. */ \
|
|
||||||
v->alloc = 0; \
|
v->alloc = 0; \
|
||||||
v->ptr = NULL; \
|
v->ptr = NULL; \
|
||||||
} \
|
} \
|
||||||
|
|||||||
Reference in new issue
Block a user