Rename _push_raw method to _push_back_raw method (Cleaner semantic)
This commit is contained in:
1 parent
8c8a1e2822
commit
46759b5f2c
7 files changed
+20
-33
No files matched your search
@@ -1415,7 +1415,6 @@ This method is created only if the `INIT_SET` operator is provided.
|
|||||||
The `_back` suffixed method will push it in the back of the container.
|
The `_back` suffixed method will push it in the back of the container.
|
||||||
The `_front` suffixed method will push it in the front of the container.
|
The `_front` suffixed method will push it in the front of the container.
|
||||||
|
|
||||||
##### `type_t *name_push_raw(name_t container)`
|
|
||||||
##### `type_t *name_push_back_raw(name_t container)`
|
##### `type_t *name_push_back_raw(name_t container)`
|
||||||
##### `type_t *name_push_front_raw(name_t container)`
|
##### `type_t *name_push_front_raw(name_t container)`
|
||||||
|
|
||||||
@@ -1885,7 +1884,7 @@ void name_clear(name_t list)
|
|||||||
void name_reset(name_t list)
|
void name_reset(name_t list)
|
||||||
type *name_back(const name_t list)
|
type *name_back(const name_t list)
|
||||||
void name_push_back(name_t list, const type value)
|
void name_push_back(name_t list, const type value)
|
||||||
type *name_push_raw(name_t list)
|
type *name_push_back_raw(name_t list)
|
||||||
type *name_push_new(name_t list)
|
type *name_push_new(name_t list)
|
||||||
void name_push_move(name_t list, type *value)
|
void name_push_move(name_t list, type *value)
|
||||||
void name_emplace_back[suffix](name_t list, args...)
|
void name_emplace_back[suffix](name_t list, args...)
|
||||||
@@ -2207,7 +2206,7 @@ void name_init_move(name_t array, name_t ref)
|
|||||||
void name_move(name_t array, name_t ref)
|
void name_move(name_t array, name_t ref)
|
||||||
void name_clear(name_t array)
|
void name_clear(name_t array)
|
||||||
void name_reset(name_t array)
|
void name_reset(name_t array)
|
||||||
type *name_push_raw(name_t array)
|
type *name_push_back_raw(name_t array)
|
||||||
void name_push_back(name_t array, const type value)
|
void name_push_back(name_t array, const type value)
|
||||||
type *name_push_new(name_t array)
|
type *name_push_new(name_t array)
|
||||||
void name_push_move(name_t array, type *val)
|
void name_push_move(name_t array, type *val)
|
||||||
@@ -9237,7 +9236,7 @@ The following methods are modified to support the memory context parameter (the
|
|||||||
* \<array\>_init_set
|
* \<array\>_init_set
|
||||||
* \<array\>_move
|
* \<array\>_move
|
||||||
* \<array\>_set_at
|
* \<array\>_set_at
|
||||||
* \<array\>_push_raw
|
* \<array\>_push_back_raw
|
||||||
* \<array\>_push_back
|
* \<array\>_push_back
|
||||||
* \<array\>_push_new
|
* \<array\>_push_new
|
||||||
* \<array\>_push_move
|
* \<array\>_push_move
|
||||||
@@ -9336,7 +9335,7 @@ The following methods are modified to support the memory context parameter (the
|
|||||||
* m-list
|
* m-list
|
||||||
* \<list\>_reset
|
* \<list\>_reset
|
||||||
* \<list\>_clear
|
* \<list\>_clear
|
||||||
* \<list\>_push_raw
|
* \<list\>_push_back_raw
|
||||||
* \<list\>_push_back
|
* \<list\>_push_back
|
||||||
* \<list\>_push_new
|
* \<list\>_push_new
|
||||||
* \<list\>_pop_back
|
* \<list\>_pop_back
|
||||||
@@ -9356,7 +9355,6 @@ The following methods are modified to support the memory context parameter (the
|
|||||||
* \<list\>_\<emplace_back\>
|
* \<list\>_\<emplace_back\>
|
||||||
* \<list\>_\<emplace_front\>
|
* \<list\>_\<emplace_front\>
|
||||||
* \<list\>_push_back_raw
|
* \<list\>_push_back_raw
|
||||||
* \<list\>_push_raw
|
|
||||||
* \<list\>_push_back
|
* \<list\>_push_back
|
||||||
* \<list\>_push_back_new
|
* \<list\>_push_back_new
|
||||||
* \<list\>_push_back_move
|
* \<list\>_push_back_move
|
||||||
|
|||||||
@@ -111,3 +111,4 @@ V0.8.0 : * Memory interface massive compatibility break to allow more efficient
|
|||||||
V0.8.1 : * m-algo: Update interface of _transform to be more flexible: adding user context pointer, and filtering of the input elements.
|
V0.8.1 : * m-algo: Update interface of _transform to be more flexible: adding user context pointer, and filtering of the input elements.
|
||||||
* m-algo: Update interface of _reduce to be more user friendly: return value indicates if the reduction is empty or not.
|
* m-algo: Update interface of _reduce to be more user friendly: return value indicates if the reduction is empty or not.
|
||||||
* m-algo: Rename _map_reduce into _transform_reduce and update its interface to be more flexible: adding user context pointer, and filtering of the input elements and return value indicates if the reduction is empty or not.
|
* m-algo: Rename _map_reduce into _transform_reduce and update its interface to be more flexible: adding user context pointer, and filtering of the input elements and return value indicates if the reduction is empty or not.
|
||||||
|
* Rename _push_raw method by _push_back_raw for all containers (clearer on the semantic)
|
||||||
@@ -367,7 +367,7 @@
|
|||||||
return &v->ptr[v->size-1]; \
|
return &v->ptr[v->size-1]; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
M_P(type *, name, _push_raw, array_t v) \
|
M_P(type *, name, _push_back_raw, array_t v) \
|
||||||
{ \
|
{ \
|
||||||
M_ARRA4_CONTRACT(v); \
|
M_ARRA4_CONTRACT(v); \
|
||||||
if (M_UNLIKELY (v->size >= v->alloc)) { \
|
if (M_UNLIKELY (v->size >= v->alloc)) { \
|
||||||
@@ -395,7 +395,7 @@
|
|||||||
M_IF_METHOD(INIT_SET, oplist)( \
|
M_IF_METHOD(INIT_SET, oplist)( \
|
||||||
M_P(void, name, _push_back, array_t v, type const x) \
|
M_P(void, name, _push_back, array_t v, type const x) \
|
||||||
{ \
|
{ \
|
||||||
type *data = M_F(name, _push_raw) M_R(v); \
|
type *data = M_F(name, _push_back_raw) M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL) ) \
|
if (M_UNLIKELY (data == NULL) ) \
|
||||||
return; \
|
return; \
|
||||||
M_IF_EXCEPTION( v->size --); \
|
M_IF_EXCEPTION( v->size --); \
|
||||||
@@ -407,7 +407,7 @@
|
|||||||
M_IF_METHOD(INIT, oplist)( \
|
M_IF_METHOD(INIT, oplist)( \
|
||||||
M_P(type *, name, _push_new, array_t v) \
|
M_P(type *, name, _push_new, array_t v) \
|
||||||
{ \
|
{ \
|
||||||
type *data = M_F(name, _push_raw) M_R(v); \
|
type *data = M_F(name, _push_back_raw) M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL) ) \
|
if (M_UNLIKELY (data == NULL) ) \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
M_IF_EXCEPTION( v->size --); \
|
M_IF_EXCEPTION( v->size --); \
|
||||||
@@ -420,7 +420,7 @@
|
|||||||
M_P(void, name, _push_move, array_t v, type *x) \
|
M_P(void, name, _push_move, array_t v, type *x) \
|
||||||
{ \
|
{ \
|
||||||
M_ASSERT (x != NULL); \
|
M_ASSERT (x != NULL); \
|
||||||
type *data = M_F(name, _push_raw) M_R(v); \
|
type *data = M_F(name, _push_back_raw) M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL) ) \
|
if (M_UNLIKELY (data == NULL) ) \
|
||||||
return; \
|
return; \
|
||||||
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
||||||
@@ -1136,7 +1136,7 @@
|
|||||||
#define M_ARRA4_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
#define M_ARRA4_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
||||||
M_P(void, name, function_name, name_t v M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
M_P(void, name, function_name, name_t v M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
||||||
{ \
|
{ \
|
||||||
M_F(name, _subtype_ct) *data = M_F(name, _push_raw) M_R(v); \
|
M_F(name, _subtype_ct) *data = M_F(name, _push_back_raw) M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL) ) \
|
if (M_UNLIKELY (data == NULL) ) \
|
||||||
return; \
|
return; \
|
||||||
M_IF_EXCEPTION( v->size --); \
|
M_IF_EXCEPTION( v->size --); \
|
||||||
|
|||||||
@@ -4748,7 +4748,7 @@ m_core_parse2_enum (const char str[], const char **endptr)
|
|||||||
|
|
||||||
|
|
||||||
/* Initialize the container 'dest' as per 'oplist' INIT operator
|
/* Initialize the container 'dest' as per 'oplist' INIT operator
|
||||||
and fill it with the given VA_ARGS arguments with the _push_raw method
|
and fill it with the given VA_ARGS arguments with the _push_back_raw method
|
||||||
allowing INIT_WITH operator for the pushed argument if the given
|
allowing INIT_WITH operator for the pushed argument if the given
|
||||||
argument is between parenthesis, otherwise an INIT_SET is performed.
|
argument is between parenthesis, otherwise an INIT_SET is performed.
|
||||||
NOTE: Parenthesis detection is the best we can do to detect a special
|
NOTE: Parenthesis detection is the best we can do to detect a special
|
||||||
@@ -4766,11 +4766,11 @@ m_core_parse2_enum (const char str[], const char **endptr)
|
|||||||
M_INIT_WITH_VAI23_FUNC(M_PAIR_1 pair, M_PAIR_2 pair, a)
|
M_INIT_WITH_VAI23_FUNC(M_PAIR_1 pair, M_PAIR_2 pair, a)
|
||||||
|
|
||||||
/* We first push a raw new item, and then we get back its pointer using _back.
|
/* We first push a raw new item, and then we get back its pointer using _back.
|
||||||
_back (contrary to _push_raw) has no side effect, and so is safe to be used
|
_back (contrary to _push_back_raw) has no side effect, and so is safe to be used
|
||||||
in a macro */
|
in a macro */
|
||||||
#define M_INIT_WITH_VAI23_FUNC(d, op, a) \
|
#define M_INIT_WITH_VAI23_FUNC(d, op, a) \
|
||||||
( \
|
( \
|
||||||
(void) M_C(M_GET_NAME op, _push_raw)(d), \
|
(void) M_C(M_GET_NAME op, _push_back_raw)(d), \
|
||||||
M_IF(M_PARENTHESIS_P(a)) \
|
M_IF(M_PARENTHESIS_P(a)) \
|
||||||
(M_CALL_INIT_WITH, M_CALL_INIT_SET) \
|
(M_CALL_INIT_WITH, M_CALL_INIT_SET) \
|
||||||
(M_GET_OPLIST op, *M_C(M_GET_NAME op, _back)(d), M_REMOVE_PARENTHESIS(a)) \
|
(M_GET_OPLIST op, *M_C(M_GET_NAME op, _back)(d), M_REMOVE_PARENTHESIS(a)) \
|
||||||
|
|||||||
@@ -280,12 +280,6 @@
|
|||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Internal, for generic INIT_WITH */ \
|
|
||||||
M_P(type *, name, _push_raw, deque_t d) \
|
|
||||||
{ \
|
|
||||||
return M_F(name, _push_back_raw)M_R(d); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
M_P(void, name, _push_back, deque_t d, type const x) \
|
M_P(void, name, _push_back, deque_t d, type const x) \
|
||||||
{ \
|
{ \
|
||||||
type *p = M_F(name, _push_back_raw)M_R(d); \
|
type *p = M_F(name, _push_back_raw)M_R(d); \
|
||||||
|
|||||||
@@ -1668,7 +1668,7 @@ enum m_d1ct_oa_element_e {
|
|||||||
M_CALL_INIT_MOVE(key_oplist, data[p].key, data[i].key); \
|
M_CALL_INIT_MOVE(key_oplist, data[p].key, data[i].key); \
|
||||||
M_CALL_INIT_MOVE(value_oplist, data[p].value, data[i].value); \
|
M_CALL_INIT_MOVE(value_oplist, data[p].value, data[i].value); \
|
||||||
} else { \
|
} else { \
|
||||||
M_F(name, _pair_ct) *ptr = M_F(name, _array_pair_push_raw)M_R(tmp); \
|
M_F(name, _pair_ct) *ptr = M_F(name, _array_pair_push_back_raw)M_R(tmp); \
|
||||||
M_CALL_INIT_MOVE(key_oplist, ptr->key, data[i].key); \
|
M_CALL_INIT_MOVE(key_oplist, ptr->key, data[i].key); \
|
||||||
M_CALL_INIT_MOVE(value_oplist, ptr->value, data[i].value); \
|
M_CALL_INIT_MOVE(value_oplist, ptr->value, data[i].value); \
|
||||||
} \
|
} \
|
||||||
@@ -1842,7 +1842,7 @@ enum m_d1ct_oa_element_e {
|
|||||||
M_CALL_INIT_MOVE(key_oplist, data[p].key, data[i].key); \
|
M_CALL_INIT_MOVE(key_oplist, data[p].key, data[i].key); \
|
||||||
M_CALL_INIT_MOVE(value_oplist, data[p].value, data[i].value); \
|
M_CALL_INIT_MOVE(value_oplist, data[p].value, data[i].value); \
|
||||||
} else { \
|
} else { \
|
||||||
M_F(name, _pair_ct) *ptr = M_F(name, _array_pair_push_raw)M_R(tmp); \
|
M_F(name, _pair_ct) *ptr = M_F(name, _array_pair_push_back_raw)M_R(tmp); \
|
||||||
M_CALL_INIT_MOVE(key_oplist, ptr->key, data[i].key); \
|
M_CALL_INIT_MOVE(key_oplist, ptr->key, data[i].key); \
|
||||||
M_CALL_INIT_MOVE(value_oplist, ptr->value, data[i].value); \
|
M_CALL_INIT_MOVE(value_oplist, ptr->value, data[i].value); \
|
||||||
} \
|
} \
|
||||||
|
|||||||
@@ -293,7 +293,7 @@
|
|||||||
return &((*v)->data); \
|
return &((*v)->data); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
M_P(type *, name, _push_raw, list_t v) \
|
M_P(type *, name, _push_back_raw, list_t v) \
|
||||||
{ \
|
{ \
|
||||||
M_L1ST_CONTRACT(v); \
|
M_L1ST_CONTRACT(v); \
|
||||||
struct M_F(name, _s) *next = M_CALL_NEW(oplist, struct M_F(name, _s)); \
|
struct M_F(name, _s) *next = M_CALL_NEW(oplist, struct M_F(name, _s)); \
|
||||||
@@ -309,7 +309,7 @@
|
|||||||
\
|
\
|
||||||
M_P(void, name, _push_back, list_t v, type const x) \
|
M_P(void, name, _push_back, list_t v, type const x) \
|
||||||
{ \
|
{ \
|
||||||
type *data = M_F(name, _push_raw)M_R(v); \
|
type *data = M_F(name, _push_back_raw)M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL)) \
|
if (M_UNLIKELY (data == NULL)) \
|
||||||
return; \
|
return; \
|
||||||
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
||||||
@@ -321,7 +321,7 @@
|
|||||||
M_IF_METHOD(INIT, oplist)( \
|
M_IF_METHOD(INIT, oplist)( \
|
||||||
M_P(type *, name, _push_new, list_t v) \
|
M_P(type *, name, _push_new, list_t v) \
|
||||||
{ \
|
{ \
|
||||||
type *data = M_F(name, _push_raw)M_R(v); \
|
type *data = M_F(name, _push_back_raw)M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL)) \
|
if (M_UNLIKELY (data == NULL)) \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
||||||
@@ -350,7 +350,7 @@
|
|||||||
M_P(void, name, _push_move, list_t v, type *x) \
|
M_P(void, name, _push_move, list_t v, type *x) \
|
||||||
{ \
|
{ \
|
||||||
M_ASSERT (x != NULL); \
|
M_ASSERT (x != NULL); \
|
||||||
type *data = M_F(name, _push_raw)M_R(v); \
|
type *data = M_F(name, _push_back_raw)M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL)) \
|
if (M_UNLIKELY (data == NULL)) \
|
||||||
return; \
|
return; \
|
||||||
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
||||||
@@ -892,7 +892,7 @@
|
|||||||
#define M_L1ST_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
#define M_L1ST_EMPLACE_DEF(name, name_t, function_name, oplist, init_func, exp_emplace_type) \
|
||||||
M_P(void, name, function_name, name_t v M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
M_P(void, name, function_name, name_t v M_EMPLACE_LIST_TYPE_VAR(a, exp_emplace_type) ) \
|
||||||
{ \
|
{ \
|
||||||
M_F(name, _subtype_ct) *data = M_F(name, _push_raw)M_R(v); \
|
M_F(name, _subtype_ct) *data = M_F(name, _push_back_raw)M_R(v); \
|
||||||
if (M_UNLIKELY (data == NULL) ) \
|
if (M_UNLIKELY (data == NULL) ) \
|
||||||
return; \
|
return; \
|
||||||
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \
|
||||||
@@ -1066,12 +1066,6 @@
|
|||||||
return ret; \
|
return ret; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
/* Internal, for INIT_WITH */ \
|
|
||||||
M_P(type *, name, _push_raw, list_t d) \
|
|
||||||
{ \
|
|
||||||
return M_F(name, _push_back_raw)M_R(d); \
|
|
||||||
} \
|
|
||||||
\
|
|
||||||
M_P(void, name, _push_back, list_t v, type const x) \
|
M_P(void, name, _push_back, list_t v, type const x) \
|
||||||
{ \
|
{ \
|
||||||
type *data = M_F(name, _push_back_raw)M_R(v); \
|
type *data = M_F(name, _push_back_raw)M_R(v); \
|
||||||
|
|||||||
Reference in new issue
Block a user