Make M*LIB stricter for INIT_MOVE operator:
* either the default INIT_MOVE operator works ('=')
* either an INIT_MOVE method is defined
* or it is disabled.
As a consequence, fix usage of testobj_t and mpz_t in the repository
The emulation layer of INIT_MOVE using INIT_SET+CLEAR is removed:
it wasn't working correctly with the local memory context
(INIT_MOVE doesn't need any local memory context to work,
whereas INIT_SET/CLEAR does)
Remove macro M_DO_INIT_MOVE as it is now useless and uses M_CALL_INIT_MOVE.
The INIT_MOVE default method no longer sets the old 'src' to '0':
it was useless (it doesn't catch any error) and complicates compiler parsing.
Fix POD & A1 & CSTR & classic oplists definition (missing INIT_MOVE operators).
This commit is contained in:
1 parent
3a39ce5a4a
commit
d548117538
19 files changed
+126
-157
No files matched your search
@@ -307,14 +307,14 @@
|
||||
type *data = M_F(name, _push_raw)M_R(v); \
|
||||
if (M_UNLIKELY (data == NULL)) \
|
||||
return; \
|
||||
M_DO_INIT_MOVE (oplist, *data, *x); \
|
||||
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
||||
} \
|
||||
\
|
||||
M_P(void, name, _pop_move, type *data, list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
M_ASSERT(*v != NULL && data != NULL); \
|
||||
M_DO_INIT_MOVE (oplist, *data, (*v)->data); \
|
||||
M_CALL_INIT_MOVE (oplist, *data, (*v)->data); \
|
||||
struct M_F(name, _s) *tofree = *v; \
|
||||
*v = (*v)->next; \
|
||||
M_CALL_DEL(oplist, tofree); \
|
||||
@@ -1057,7 +1057,7 @@
|
||||
type *data = M_F(name, _push_back_raw)M_R(v); \
|
||||
if (M_UNLIKELY (data == NULL)) \
|
||||
return; \
|
||||
M_DO_INIT_MOVE (oplist, *data, *x); \
|
||||
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
||||
} \
|
||||
\
|
||||
M_P(void, name, _push_move, list_t v, type *x) \
|
||||
@@ -1091,7 +1091,7 @@
|
||||
M_ASSERT (v->back != NULL); \
|
||||
M_ASSERT (data != NULL); \
|
||||
struct M_F(name, _s) *tofree = v->back; \
|
||||
M_DO_INIT_MOVE (oplist, *data, tofree->data); \
|
||||
M_CALL_INIT_MOVE (oplist, *data, tofree->data); \
|
||||
v->back = tofree->next; \
|
||||
M_CALL_DEL(oplist, tofree); \
|
||||
/* Update front too if the list became empty */ \
|
||||
@@ -1149,7 +1149,7 @@
|
||||
type *data = M_F(name, _push_front_raw)(v); \
|
||||
if (M_UNLIKELY (data == NULL)) \
|
||||
return; \
|
||||
M_DO_INIT_MOVE (oplist, *data, *x); \
|
||||
M_CALL_INIT_MOVE (oplist, *data, *x); \
|
||||
} \
|
||||
\
|
||||
M_IF_METHOD(INIT, oplist)( \
|
||||
|
||||
Reference in new issue
Block a user