Rename LIST _clean in _reset to avoid confusing _clean & _clear functions. See #97
This commit is contained in:
1 parent
f172bbaad2
commit
f6e3cbbb65
3 files changed
+32
-21
No files matched your search
@@ -998,10 +998,9 @@ Clear the list 'list (aka destructor), calling the CLEAR method of all the
|
||||
objects of the list and freeing memory.
|
||||
The list can't be used anymore, except with a constructor.
|
||||
|
||||
##### void name\_clean(name\_t list)
|
||||
##### void name\_reset(name\_t list)
|
||||
|
||||
Clean the list (the list becomes empty).
|
||||
It is like CLEAR but the list remains initialized and empty.
|
||||
Reset the list (the list becomes empty but remains initialized and empty).
|
||||
|
||||
##### type *name\_back(const name\_t list)
|
||||
|
||||
@@ -1319,9 +1318,9 @@ After-wise 'ref' is cleared and can no longer be used.
|
||||
|
||||
Clear the list 'list (aka destructor). The list can't be used anymore, except with a constructor.
|
||||
|
||||
##### void name\_clean(name\_t list)
|
||||
##### void name\_reset(name\_t list)
|
||||
|
||||
Clean the list (the list becomes empty). The list remains initialized but is empty.
|
||||
Clean the list (the list becomes empty but remains initialized but is empty).
|
||||
|
||||
##### type *name\_back(const name\_t list)
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
IT_CREF(M_C(name,_cref)), \
|
||||
IT_INSERT(M_C(name, _insert)), \
|
||||
IT_REMOVE(M_C(name,_remove)), \
|
||||
CLEAN(M_C(name,_clean)), \
|
||||
CLEAN(M_C(name,_reset)), \
|
||||
PUSH(M_C(name,_push_back)), \
|
||||
POP(M_C(name,_pop_back)), \
|
||||
PUSH_MOVE(M_C(name,_push_move)), \
|
||||
@@ -242,7 +242,7 @@
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_C(name, _clean)(list_t v) \
|
||||
M_C(name, _reset)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_CONTRACT(v); \
|
||||
struct M_C(name, _s) *it = *v; \
|
||||
@@ -256,10 +256,16 @@
|
||||
M_L1ST_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void M_ATTR_DEPRECATED \
|
||||
M_C(name, _clean)(list_t v) \
|
||||
{ \
|
||||
M_C(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_C(name, _clear)(list_t v) \
|
||||
{ \
|
||||
M_C(name, _clean)(v); \
|
||||
M_C(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
@@ -724,7 +730,7 @@
|
||||
M_C(name, _parse_str)(list_t list, const char str[], const char **endp) \
|
||||
{ \
|
||||
M_ASSERT (str != NULL && list != NULL); \
|
||||
M_C(name,_clean)(list); \
|
||||
M_C(name,_reset)(list); \
|
||||
bool success = false; \
|
||||
int c = *str++; \
|
||||
if (M_UNLIKELY (c != '[')) goto exit; \
|
||||
@@ -755,7 +761,7 @@
|
||||
M_C(name, _in_str)(list_t list, FILE *file) \
|
||||
{ \
|
||||
M_ASSERT (file != NULL && list != NULL); \
|
||||
M_C(name,_clean)(list); \
|
||||
M_C(name,_reset)(list); \
|
||||
int c = fgetc(file); \
|
||||
if (M_UNLIKELY (c != '[')) return false; \
|
||||
c = fgetc(file); \
|
||||
@@ -810,7 +816,7 @@
|
||||
m_serial_return_code_t ret; \
|
||||
m_serial_local_t local; \
|
||||
size_t estimated_size = 0; \
|
||||
M_C(name,_clean)(list); \
|
||||
M_C(name,_reset)(list); \
|
||||
ret = f->m_interface->read_array_start(local, f, &estimated_size); \
|
||||
if (M_UNLIKELY (ret != M_SERIAL_OK_CONTINUE)) return ret; \
|
||||
type item; \
|
||||
@@ -953,7 +959,7 @@
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_C(name, _clean)(list_t v) \
|
||||
M_C(name, _reset)(list_t v) \
|
||||
{ \
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
struct M_C(name, _s) *it = v->back; \
|
||||
@@ -968,10 +974,16 @@
|
||||
M_L1ST_DUAL_PUSH_CONTRACT(v); \
|
||||
} \
|
||||
\
|
||||
static inline void M_ATTR_DEPRECATED \
|
||||
M_C(name, _clean)(list_t v) \
|
||||
{ \
|
||||
M_C(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline void \
|
||||
M_C(name, _clear)(list_t v) \
|
||||
{ \
|
||||
M_C(name, _clean)(v); \
|
||||
M_C(name, _reset)(v); \
|
||||
} \
|
||||
\
|
||||
static inline type * \
|
||||
@@ -1307,7 +1319,7 @@
|
||||
struct M_C(name, _s) *it_org; \
|
||||
struct M_C(name, _s) **update_list; \
|
||||
if (M_UNLIKELY (list == org)) return; \
|
||||
M_C(name, _clean)(list); \
|
||||
M_C(name, _reset)(list); \
|
||||
update_list = &list->back; \
|
||||
it_org = org->back; \
|
||||
while (it_org != NULL) { \
|
||||
|
||||
+7
-7
@@ -124,7 +124,7 @@ static void test_uint(void)
|
||||
list_uint_it(u2, v2); //v2 is the first el
|
||||
assert (*list_uint_cref(u2) == 997);
|
||||
|
||||
list_uint_clean(v);
|
||||
list_uint_reset(v);
|
||||
assert (list_uint_empty_p(v) == true);
|
||||
assert (list_uint_empty_p(v2) == false);
|
||||
assert (list_uint_size(v2) == 998);
|
||||
@@ -182,7 +182,7 @@ static void test_uint(void)
|
||||
assert(list_uint_equal_p(v,v2));
|
||||
assert(list_uint_equal_p(v,v));
|
||||
|
||||
list_uint_clean(v);
|
||||
list_uint_reset(v);
|
||||
list_uint_push_back (v2, 14562398);
|
||||
list_uint_it(u, v2);
|
||||
s2 = list_uint_size(v2);
|
||||
@@ -207,8 +207,8 @@ static void test_uint(void)
|
||||
assert (x == 1478963);
|
||||
assert (s == *list_uint_back(v));
|
||||
|
||||
list_uint_clean(v);
|
||||
list_uint_clean(v2);
|
||||
list_uint_reset(v);
|
||||
list_uint_reset(v2);
|
||||
for(unsigned int i = 0; i < 10; i++)
|
||||
list_uint_push_back (v, i);
|
||||
list_uint_it (u, v);
|
||||
@@ -290,7 +290,7 @@ static void test_mpz(void)
|
||||
assert (list_mpz_equal_p (v, list2));
|
||||
list_mpz_clear(list2);
|
||||
|
||||
list_mpz_clean(v);
|
||||
list_mpz_reset(v);
|
||||
list_mpz_init(list2);
|
||||
M_LET(str, STRING_OPLIST) {
|
||||
list_mpz_get_str(str, v, false);
|
||||
@@ -598,8 +598,8 @@ static void test_dual_it1(void)
|
||||
list2_double_next(it2);
|
||||
assert(*list2_double_cref(it2) == 1.0);
|
||||
|
||||
list2_double_clean(list);
|
||||
list2_double_clean(list2);
|
||||
list2_double_reset(list);
|
||||
list2_double_reset(list2);
|
||||
for(double i = 0; i < 10; i++)
|
||||
list2_double_push_back (list, i);
|
||||
list2_double_it (it, list);
|
||||
|
||||
Reference in new issue
Block a user