Define internal M_INLINE:
it is used to control the inline semantics. By combining it with optimize option "-fno-inline" for the internal M*LIB function (using _Pragma optimize) we can control easily if we want to use an inline version or call of an external function. Define new user API: * M_USE_EXTERN_DECL : define it before including any MLIB header to requests to call the M*LIB functions and don't inline then. * M_USE_EXTERN_DEF : define it once in a translation unit to define the M*LIB functions. This translation unit shall contain all templated macro too. If you use one option, you need to use the other one too for another translation unit.
This commit is contained in:
1 parent
2628536d20
commit
b50813713a
30 files changed
+1271
-1237
No files matched your search
@@ -161,19 +161,19 @@
|
||||
\
|
||||
MEMPOOL_DEF(M_F(name, _mempool), struct M_F(name, _s)) \
|
||||
M_GET_MEMPOOL_LINKAGE oplist M_F(name, _mempool_t) M_GET_MEMPOOL oplist; \
|
||||
static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \
|
||||
M_INLINE struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \
|
||||
return M_F(name, _mempool_alloc)(M_GET_MEMPOOL oplist); \
|
||||
} \
|
||||
static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \
|
||||
M_INLINE void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \
|
||||
M_F(name, _mempool_free)(M_GET_MEMPOOL oplist, ptr); \
|
||||
} \
|
||||
\
|
||||
, /* No mempool allocation */ \
|
||||
\
|
||||
static inline struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \
|
||||
M_INLINE struct M_F(name, _s) *M_C3(m_l1st_,name,_new)(void) { \
|
||||
return M_CALL_NEW(oplist, struct M_F(name, _s)); \
|
||||
} \
|
||||
static inline void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \
|
||||
M_INLINE void M_C3(m_l1st_,name,_del)(struct M_F(name, _s) *ptr) { \
|
||||
M_CALL_DEL(oplist, ptr); \
|
||||
} \
|
||||
) \
|
||||
@@ -231,14 +231,14 @@
|
||||
*/
|
||||
#define M_L1ST_DEF_P4(name, type, oplist, list_t, it_t) \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init)(list_t v) \
|
||||
{ \
|
||||
M_ASSERT (v != NULL); \
|
||||
*v = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _reset)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -253,13 +253,13 @@
|
||||
M_L1ST_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _clear)(list_t v) \
|
||||
{ \
|
||||
M_F(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _back)(const list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -267,7 +267,7 @@
|
||||
return &((*v)->data); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_raw)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -284,7 +284,7 @@
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_back)(list_t v, type const x) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_raw)(v); \
|
||||
@@ -294,7 +294,7 @@
|
||||
} \
|
||||
\
|
||||
M_IF_METHOD(INIT, oplist)( \
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_new)(list_t v) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_raw)(v); \
|
||||
@@ -305,7 +305,7 @@
|
||||
} \
|
||||
, /* No INIT */) \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _pop_back)(type *data, list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -321,7 +321,7 @@
|
||||
M_L1ST_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_move)(list_t v, type *x) \
|
||||
{ \
|
||||
M_ASSERT (x != NULL); \
|
||||
@@ -331,7 +331,7 @@
|
||||
M_DO_INIT_MOVE (oplist, *data, *x); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _pop_move)(type *data, list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -343,14 +343,14 @@
|
||||
M_L1ST_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _empty_p)(const list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
return *v == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _swap)(list_t l, list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(l); \
|
||||
@@ -360,7 +360,7 @@
|
||||
M_L1ST_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it)(it_t it, const list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -369,7 +369,7 @@
|
||||
it->previous = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it_set)(it_t it1, const it_t it2) \
|
||||
{ \
|
||||
M_ASSERT (it1 != NULL && it2 != NULL); \
|
||||
@@ -377,7 +377,7 @@
|
||||
it1->previous = it2->previous; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it_end)(it_t it1, const list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
@@ -387,21 +387,21 @@
|
||||
it1->previous = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _end_p)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT (it != NULL); \
|
||||
return it->current == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _last_p)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT (it != NULL); \
|
||||
return it->current == NULL || it->current->next == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _next)(it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
@@ -409,28 +409,28 @@
|
||||
it->current = it->current->next; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _it_equal_p)(const it_t it1, const it_t it2) \
|
||||
{ \
|
||||
M_ASSERT(it1 != NULL && it2 != NULL); \
|
||||
return it1->current == it2->current; \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _ref)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
return &(it->current->data); \
|
||||
} \
|
||||
\
|
||||
static inline type const * \
|
||||
M_INLINE type const * \
|
||||
M_F(name, _cref)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
return M_CONST_CAST(type, &(it->current->data)); \
|
||||
} \
|
||||
\
|
||||
static inline size_t \
|
||||
M_INLINE size_t \
|
||||
M_F(name, _size)(const list_t list) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list); \
|
||||
@@ -443,7 +443,7 @@
|
||||
return size; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _sublist_p)(const list_t list, const it_t itsub) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list); \
|
||||
@@ -457,7 +457,7 @@
|
||||
return (itsub->current == NULL); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _get)(const list_t list, size_t i) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list); \
|
||||
@@ -474,13 +474,13 @@
|
||||
} \
|
||||
} \
|
||||
\
|
||||
static inline type const * \
|
||||
M_INLINE type const * \
|
||||
M_F(name, _cget)(const list_t l, size_t i) \
|
||||
{ \
|
||||
return M_CONST_CAST(type, M_F(name, _get)(l,i)); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _insert)(list_t list, it_t insertion_point, \
|
||||
type const x) \
|
||||
{ \
|
||||
@@ -506,7 +506,7 @@
|
||||
M_L1ST_CONTRACT(list); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _remove)(list_t list, it_t removing_point) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list); \
|
||||
@@ -525,7 +525,7 @@
|
||||
M_L1ST_CONTRACT(list); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init_set)(list_t list, const list_t org) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(org); \
|
||||
@@ -549,7 +549,7 @@
|
||||
M_L1ST_CONTRACT(list); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _set)(list_t list, const list_t org) \
|
||||
{ \
|
||||
if (M_UNLIKELY (list == org)) return; \
|
||||
@@ -557,7 +557,7 @@
|
||||
M_F(name, _init_set)(list, org); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init_move)(list_t list, list_t org) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(org); \
|
||||
@@ -566,7 +566,7 @@
|
||||
*org = NULL; /* safer */ \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _move)(list_t list, list_t org) \
|
||||
{ \
|
||||
M_ASSERT (list != org); \
|
||||
@@ -574,7 +574,7 @@
|
||||
M_F(name, _init_move)(list, org); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice_back)(list_t nv, list_t ov, it_t it) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(nv); \
|
||||
@@ -598,7 +598,7 @@
|
||||
*nv = current; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice_at)(list_t nlist, it_t npos, \
|
||||
list_t olist, it_t opos) \
|
||||
{ \
|
||||
@@ -636,7 +636,7 @@
|
||||
M_L1ST_CONTRACT(olist); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice)(list_t list1, list_t list2) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list1); \
|
||||
@@ -652,7 +652,7 @@
|
||||
*list2 = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _reverse)(list_t list) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(list); \
|
||||
@@ -682,7 +682,7 @@
|
||||
#define M_L1ST_ITBASE_DEF(name, type, oplist, list_t, it_t) \
|
||||
\
|
||||
M_IF_METHOD(GET_STR, oplist)( \
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _get_str)(m_string_t str, const list_t list, \
|
||||
bool append) \
|
||||
{ \
|
||||
@@ -702,7 +702,7 @@
|
||||
, /* no str */ ) \
|
||||
\
|
||||
M_IF_METHOD(OUT_STR, oplist)( \
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _out_str)(FILE *file, const list_t list) \
|
||||
{ \
|
||||
M_ASSERT (file != NULL && list != NULL); \
|
||||
@@ -721,7 +721,7 @@
|
||||
, /* no out_str */ ) \
|
||||
\
|
||||
M_IF_METHOD2(PARSE_STR, INIT, oplist)( \
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _parse_str)(list_t list, const char str[], const char **endp) \
|
||||
{ \
|
||||
M_ASSERT (str != NULL && list != NULL); \
|
||||
@@ -752,7 +752,7 @@
|
||||
, /* no PARSE_STR & INIT */ ) \
|
||||
\
|
||||
M_IF_METHOD2(IN_STR, INIT, oplist)( \
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _in_str)(list_t list, FILE *file) \
|
||||
{ \
|
||||
M_ASSERT (file != NULL && list != NULL); \
|
||||
@@ -778,7 +778,7 @@
|
||||
, /* no IN_STR & INIT */ ) \
|
||||
\
|
||||
M_IF_METHOD(OUT_SERIAL, oplist)( \
|
||||
static inline m_serial_return_code_t \
|
||||
M_INLINE m_serial_return_code_t \
|
||||
M_F(name, _out_serial)(m_serial_write_t f, const list_t list) \
|
||||
{ \
|
||||
M_ASSERT (list != NULL); \
|
||||
@@ -807,7 +807,7 @@
|
||||
, /* no OUT_SERIAL */ ) \
|
||||
\
|
||||
M_IF_METHOD2(IN_SERIAL, INIT, oplist)( \
|
||||
static inline m_serial_return_code_t \
|
||||
M_INLINE m_serial_return_code_t \
|
||||
M_F(name, _in_serial)(list_t list, m_serial_read_t f) \
|
||||
{ \
|
||||
M_ASSERT (list != NULL); \
|
||||
@@ -833,7 +833,7 @@
|
||||
, /* no IN_SERIAL & INIT */ ) \
|
||||
\
|
||||
M_IF_METHOD(EQUAL, oplist)( \
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _equal_p)(const list_t list1, const list_t list2) \
|
||||
{ \
|
||||
M_ASSERT (list1 != NULL && list2 != NULL); \
|
||||
@@ -857,7 +857,7 @@
|
||||
, /* no equal */ ) \
|
||||
\
|
||||
M_IF_METHOD(HASH, oplist)( \
|
||||
static inline size_t \
|
||||
M_INLINE size_t \
|
||||
M_F(name, _hash)(const list_t list) \
|
||||
{ \
|
||||
M_ASSERT (list != NULL); \
|
||||
@@ -877,7 +877,7 @@
|
||||
|
||||
/* Definition of the emplace_back function for single list */
|
||||
#define M_L1ST_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
function_name(name_t v \
|
||||
M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
||||
{ \
|
||||
@@ -890,7 +890,7 @@
|
||||
|
||||
/* Definition of the emplace_back function for dual push list */
|
||||
#define M_L1ST_EMPLACE_BACK_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
function_name(name_t v \
|
||||
M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
||||
{ \
|
||||
@@ -903,7 +903,7 @@
|
||||
|
||||
/* Definition of the emplace_front function for dual push list */
|
||||
#define M_L1ST_EMPLACE_FRONT_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
function_name(name_t v \
|
||||
M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
||||
{ \
|
||||
@@ -987,7 +987,7 @@
|
||||
*/
|
||||
#define M_L1ST_DUAL_PUSH_DEF_P4(name, type, oplist, list_t, it_t) \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init)(list_t v) \
|
||||
{ \
|
||||
M_ASSERT( v != NULL); \
|
||||
@@ -996,7 +996,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _reset)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1012,13 +1012,13 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _clear)(list_t v) \
|
||||
{ \
|
||||
M_F(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _back)(const list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1026,7 +1026,7 @@
|
||||
return &(v->back->data); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_back_raw)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1048,13 +1048,13 @@
|
||||
} \
|
||||
\
|
||||
/* Internal, for INIT_WITH */ \
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_raw)(list_t d) \
|
||||
{ \
|
||||
return M_F(name, _push_back_raw)(d); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_back)(list_t v, type const x) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_back_raw)(v); \
|
||||
@@ -1064,7 +1064,7 @@
|
||||
} \
|
||||
\
|
||||
M_IF_METHOD(INIT, oplist)( \
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_back_new)(list_t v) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_back_raw)(v); \
|
||||
@@ -1075,7 +1075,7 @@
|
||||
} \
|
||||
, /* No INIT */ ) \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_back_move)(list_t v, type *x) \
|
||||
{ \
|
||||
M_ASSERT (x != NULL); \
|
||||
@@ -1085,13 +1085,13 @@
|
||||
M_DO_INIT_MOVE (oplist, *data, *x); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_move)(list_t v, type *x) \
|
||||
{ \
|
||||
M_F(name, _push_back_move)(v, x); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _pop_back)(type *data, list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1112,7 +1112,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _pop_move)(type *data, list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1130,7 +1130,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _front)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1138,7 +1138,7 @@
|
||||
return &(v->front->data); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_front_raw)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1160,7 +1160,7 @@
|
||||
return ret; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_front)(list_t v, type const x) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_front_raw)(v); \
|
||||
@@ -1169,7 +1169,7 @@
|
||||
M_CALL_INIT_SET(oplist, *data, x); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _push_front_move)(list_t v, type *x) \
|
||||
{ \
|
||||
M_ASSERT (x != NULL); \
|
||||
@@ -1180,7 +1180,7 @@
|
||||
} \
|
||||
\
|
||||
M_IF_METHOD(INIT, oplist)( \
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _push_front_new)(list_t v) \
|
||||
{ \
|
||||
type *data = M_F(name, _push_back_raw)(v); \
|
||||
@@ -1191,14 +1191,14 @@
|
||||
} \
|
||||
, /* No INIT */) \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _empty_p)(const list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
return v->back == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _swap)(list_t l, list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(l); \
|
||||
@@ -1207,7 +1207,7 @@
|
||||
M_SWAP(struct M_F(name, _s) *, l->back, v->back); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it)(it_t it, const list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1216,7 +1216,7 @@
|
||||
it->previous = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it_set)(it_t it1, const it_t it2) \
|
||||
{ \
|
||||
M_ASSERT (it1 != NULL && it2 != NULL); \
|
||||
@@ -1224,7 +1224,7 @@
|
||||
it1->previous = it2->previous; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _it_end)(it_t it1, const list_t v) \
|
||||
{ \
|
||||
M_ASSERT (it1 != NULL); \
|
||||
@@ -1234,21 +1234,21 @@
|
||||
it1->previous = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _end_p)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT (it != NULL); \
|
||||
return it->current == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _last_p)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT (it != NULL); \
|
||||
return it->current == NULL || it->current->next == NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _next)(it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
@@ -1256,28 +1256,28 @@
|
||||
it->current = it->current->next; \
|
||||
} \
|
||||
\
|
||||
static inline bool \
|
||||
M_INLINE bool \
|
||||
M_F(name, _it_equal_p)(const it_t it1, const it_t it2) \
|
||||
{ \
|
||||
M_ASSERT(it1 != NULL && it2 != NULL); \
|
||||
return it1->current == it2->current; \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
M_INLINE type * \
|
||||
M_F(name, _ref)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
return &(it->current->data); \
|
||||
} \
|
||||
\
|
||||
static inline type const * \
|
||||
M_INLINE type const * \
|
||||
M_F(name, _cref)(const it_t it) \
|
||||
{ \
|
||||
M_ASSERT(it != NULL && it->current != NULL); \
|
||||
return M_CONST_CAST(type, &(it->current->data)); \
|
||||
} \
|
||||
\
|
||||
static inline size_t \
|
||||
M_INLINE size_t \
|
||||
M_F(name, _size)(const list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
@@ -1290,7 +1290,7 @@
|
||||
return size; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _insert)(list_t list, it_t insertion_point, \
|
||||
type const x) \
|
||||
{ \
|
||||
@@ -1319,7 +1319,7 @@
|
||||
} \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _remove)(list_t list, it_t removing_point) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list); \
|
||||
@@ -1342,7 +1342,7 @@
|
||||
removing_point->current = next; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _set)(list_t list, const list_t org) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list); \
|
||||
@@ -1369,7 +1369,7 @@
|
||||
*update_list = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init_set)(list_t list, const list_t org) \
|
||||
{ \
|
||||
M_ASSERT (list != org); \
|
||||
@@ -1377,7 +1377,7 @@
|
||||
M_F(name, _set)(list, org); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _init_move)(list_t list, list_t org) \
|
||||
{ \
|
||||
M_ASSERT (list != org); \
|
||||
@@ -1387,14 +1387,14 @@
|
||||
org->front = NULL; \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _move)(list_t list, list_t org) \
|
||||
{ \
|
||||
M_F(name, _clear)(list); \
|
||||
M_F(name, _init_move)(list, org); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice_back)(list_t list1, list_t list2, it_t it) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list1); \
|
||||
@@ -1426,7 +1426,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list2); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice_at)(list_t nlist, it_t npos, \
|
||||
list_t olist, it_t opos) \
|
||||
{ \
|
||||
@@ -1474,7 +1474,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(olist); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _splice)(list_t list1, list_t list2) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list1); \
|
||||
@@ -1494,7 +1494,7 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list2); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_INLINE void \
|
||||
M_F(name, _reverse)(list_t list) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(list); \
|
||||
|
||||
Reference in new issue
Block a user