37 #endif // EXTERNAL_LOCKS
41 #define VECTOR_ELEM_SZ(_v) ( _h->value_len )
43 #define VECTOR_FLAG_BIGLOCK 0x01 // support multithreaded access with a single big lock
44 #define VECTOR_FLAG_INITZERO 0x02 // internally init the vector objects to 0
45 #define VECTOR_FLAG_BIGRESIZE 0x04 // appends will be common - speculatively allocate extra memory
46 #define VECTOR_REDUCE_DELETE (1) // indicate that a delete should be done during the reduction
66 #define cf_vector_define(__x, __value_len, __flags) \
67 uint8_t cf_vector##__x[1024]; cf_vector __x; cf_vector_init_smalloc(&__x, __value_len, cf_vector##__x, sizeof(cf_vector##__x), __flags);
72 #define cf_vector_define_clone(__source, __target) \
73 uint8_t cf_vector##__target[__source.len]; cf_vector __target; cf_vector_clone_stack(&__source, &__target, cf_vector##__target);
85 #define cf_vector_reset( __v ) (__v)->len = 0; if ( (__v)->flags & VECTOR_FLAG_INITZERO) memset( (__v)->vector, 0, (__v)->alloc_len * (__v)->value_len);
109 static inline unsigned int cf_vector_size(
cf_vector *v)
125 static inline cf_vector *cf_vector_pointer_create(uint32_t init_sz, uint32_t flags)
130 static inline int cf_vector_pointer_init(
cf_vector *v, uint32_t init_sz, uint32_t flags)
135 static inline int cf_vector_pointer_set(
cf_vector *v, uint32_t
index,
void *p)
140 static inline void * cf_vector_pointer_get(
cf_vector *v, uint32_t index) {
146 static inline int cf_vector_pointer_append(
cf_vector *v,
void *p)
155 static inline cf_vector *cf_vector_integer_create(uint32_t init_sz, uint32_t flags)
160 static inline int cf_vector_integer_init(
cf_vector *v, uint32_t init_sz, uint32_t flags)
165 static inline int cf_vector_integer_set(
cf_vector *v, uint32_t index,
int i)
170 static inline int cf_vector_integer_get(
cf_vector *v, uint32_t index) {
176 static inline int cf_vector_integer_append(
cf_vector *v,
int i)