Bug #536 ยป 0031-specvec.h-Add-function-headers-for-inline-functions.patch
| utility/specvec.h | ||
|---|---|---|
|
size_t size, size_alloc;
|
||
|
};
|
||
|
/**********************************************************************//**
|
||
|
Initialize the vector
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_init) (SPECVEC_VECTOR *tthis)
|
||
|
{
|
||
|
tthis->p = nullptr;
|
||
|
tthis->size = tthis->size_alloc = 0;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Allocate vector to at least to size 'size'
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_reserve) (SPECVEC_VECTOR *tthis,
|
||
|
size_t size)
|
||
|
{
|
||
| ... | ... | |
|
tthis->size = size;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Return size of the vector
|
||
|
**************************************************************************/
|
||
|
static inline size_t SPECVEC_FOO(_vector_size) (const SPECVEC_VECTOR *tthis)
|
||
|
{
|
||
|
return tthis->size;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Get element at position svindex
|
||
|
**************************************************************************/
|
||
|
static inline SPECVEC_TYPE *SPECVEC_FOO(_vector_get) (const SPECVEC_VECTOR
|
||
|
*tthis,
|
||
|
int svindex)
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
/* You must _init "*to" before using this function */
|
||
|
/**********************************************************************//**
|
||
|
Copy vector to vector.
|
||
|
"*to" must be initialized by the _init() before the call.
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_copy) (SPECVEC_VECTOR *to,
|
||
|
const SPECVEC_VECTOR *from)
|
||
|
{
|
||
| ... | ... | |
|
}
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Free the vector
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_free) (SPECVEC_VECTOR *tthis)
|
||
|
{
|
||
|
if (tthis->p) {
|
||
| ... | ... | |
|
SPECVEC_FOO(_vector_init)(tthis);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Add pfoo to the end of the vector
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_append) (SPECVEC_VECTOR *tthis,
|
||
|
SPECVEC_TYPE const pfoo)
|
||
|
{
|
||
| ... | ... | |
|
tthis->p[tthis->size - 1] = pfoo;
|
||
|
}
|
||
|
/**************************************************************************
|
||
|
/**********************************************************************//**
|
||
|
Remove element number svindex from the vector.
|
||
|
**************************************************************************/
|
||
|
static inline void SPECVEC_FOO(_vector_remove) (SPECVEC_VECTOR *tthis,
|
||