55#error Must define a SPECVEC_TAG to use this header
58#define SPECVEC_TYPE struct SPECVEC_TAG
61#define SPECVEC_PASTE_(x,y) x ## y
62#define SPECVEC_PASTE(x,y) SPECVEC_PASTE_(x,y)
64#define SPECVEC_VECTOR struct SPECVEC_PASTE(SPECVEC_TAG, _vector)
66#define SPECVEC_FOO(suffix) SPECVEC_PASTE(SPECVEC_TAG, suffix)
81 tthis->size = tthis->size_alloc = 0;
90 if (
size > tthis->size_alloc) {
91 size_t new_size =
MAX(
size, tthis->size_alloc * 2);
94 new_size *
sizeof(*tthis->p));
95 tthis->size_alloc = new_size;
115 if (svindex == -1 && tthis->size > 0) {
116 return tthis->p + tthis->size - 1;
117 }
else if (svindex >= 0 && (
size_t)svindex < tthis->size) {
118 return tthis->p + svindex;
133 if (from->size > 0) {
134 memcpy(to->p, from->p, from->size *
sizeof(*to->p));
156 tthis->p[tthis->size - 1] = pfoo;
169 const size_t rmpos = (svindex < 0 ?
177 tthis->p[i] = tthis->p[i + 1];
186#define TYPED_VECTOR_ITERATE(atype, vector, var) { \
187 unsigned int myiter##var; \
189 for (myiter##var = 0; myiter##var < (vector)->size; myiter##var++) { \
190 var = &(vector)->p[myiter##var]; \
193#define VECTOR_ITERATE_END }}
#define fc_assert_ret(condition)
#define fc_realloc(ptr, sz)
static void SPECVEC_FOO() _vector_append(SPECVEC_VECTOR *tthis, SPECVEC_TYPE const pfoo)
static void SPECVEC_FOO() _vector_free(SPECVEC_VECTOR *tthis)
static void SPECVEC_FOO() _vector_init(SPECVEC_VECTOR *tthis)
static void SPECVEC_FOO() _vector_remove(SPECVEC_VECTOR *tthis, const int svindex)
#define SPECVEC_FOO(suffix)
static void SPECVEC_FOO() _vector_copy(SPECVEC_VECTOR *to, const SPECVEC_VECTOR *from)
static size_t SPECVEC_FOO() _vector_size(const SPECVEC_VECTOR *tthis)
static void SPECVEC_FOO() _vector_reserve(SPECVEC_VECTOR *tthis, size_t size)
static SPECVEC_TYPE *SPECVEC_FOO() _vector_get(const SPECVEC_VECTOR *tthis, int svindex)