From 46759b5f2c15d8f038aacee4b0bc35002498554d Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Sat, 26 Jul 2025 10:35:48 +0200 Subject: [PATCH] Rename _push_raw method to _push_back_raw method (Cleaner semantic) --- README.md | 10 ++++------ doc/API.txt | 1 + m-array.h | 10 +++++----- m-core.h | 6 +++--- m-deque.h | 6 ------ m-dict.h | 4 ++-- m-list.h | 16 +++++----------- 7 files changed, 20 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 7c55b611..25ab3c83 100644 --- a/README.md +++ b/README.md @@ -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 `_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_front_raw(name_t container)` @@ -1885,7 +1884,7 @@ void name_clear(name_t list) void name_reset(name_t list) type *name_back(const name_t list) 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) void name_push_move(name_t list, type *value) 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_clear(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) type *name_push_new(name_t array) 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 * \_init_set * \_move * \_set_at - * \_push_raw + * \_push_back_raw * \_push_back * \_push_new * \_push_move @@ -9336,7 +9335,7 @@ The following methods are modified to support the memory context parameter (the * m-list * \_reset * \_clear - * \_push_raw + * \_push_back_raw * \_push_back * \_push_new * \_pop_back @@ -9356,7 +9355,6 @@ The following methods are modified to support the memory context parameter (the * \_\ * \_\ * \_push_back_raw - * \_push_raw * \_push_back * \_push_back_new * \_push_back_move diff --git a/doc/API.txt b/doc/API.txt index 1908d447..3c8e3d3f 100644 --- a/doc/API.txt +++ b/doc/API.txt @@ -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. * 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. + * Rename _push_raw method by _push_back_raw for all containers (clearer on the semantic) diff --git a/m-array.h b/m-array.h index 01d42235..2571d020 100644 --- a/m-array.h +++ b/m-array.h @@ -367,7 +367,7 @@ 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); \ if (M_UNLIKELY (v->size >= v->alloc)) { \ @@ -395,7 +395,7 @@ M_IF_METHOD(INIT_SET, oplist)( \ 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) ) \ return; \ M_IF_EXCEPTION( v->size --); \ @@ -407,7 +407,7 @@ M_IF_METHOD(INIT, oplist)( \ 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) ) \ return NULL; \ M_IF_EXCEPTION( v->size --); \ @@ -420,7 +420,7 @@ M_P(void, name, _push_move, array_t v, type *x) \ { \ 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) ) \ return; \ 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) \ 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) ) \ return; \ M_IF_EXCEPTION( v->size --); \ diff --git a/m-core.h b/m-core.h index 45fead44..09f92168 100644 --- a/m-core.h +++ b/m-core.h @@ -4748,7 +4748,7 @@ m_core_parse2_enum (const char str[], const char **endptr) /* 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 argument is between parenthesis, otherwise an INIT_SET is performed. 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) /* 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 */ #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_CALL_INIT_WITH, M_CALL_INIT_SET) \ (M_GET_OPLIST op, *M_C(M_GET_NAME op, _back)(d), M_REMOVE_PARENTHESIS(a)) \ diff --git a/m-deque.h b/m-deque.h index 42cfec4c..a60bc83e 100644 --- a/m-deque.h +++ b/m-deque.h @@ -280,12 +280,6 @@ 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) \ { \ type *p = M_F(name, _push_back_raw)M_R(d); \ diff --git a/m-dict.h b/m-dict.h index 3c5a70d1..3f3cdfc2 100644 --- a/m-dict.h +++ b/m-dict.h @@ -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(value_oplist, data[p].value, data[i].value); \ } 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(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(value_oplist, data[p].value, data[i].value); \ } 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(value_oplist, ptr->value, data[i].value); \ } \ diff --git a/m-list.h b/m-list.h index 0d02fd58..f7baebf4 100644 --- a/m-list.h +++ b/m-list.h @@ -293,7 +293,7 @@ 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); \ 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) \ { \ - 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)) \ return; \ M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \ @@ -321,7 +321,7 @@ M_IF_METHOD(INIT, oplist)( \ 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)) \ return NULL; \ 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_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)) \ return; \ 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) \ 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) ) \ return; \ M_IF_EXCEPTION(struct M_F(name, _s) *next = *v ); \ @@ -1066,12 +1066,6 @@ 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) \ { \ type *data = M_F(name, _push_back_raw)M_R(v); \