From e1b1f5e861f289296829c643d65587a49ab63b26 Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Mon, 22 May 2017 19:25:30 +0200 Subject: [PATCH] remove expects now an iterator. <== Uniformisation of the containers. (List expect an iterator too). --- m-array.h | 12 ++++++------ tests/test-marray.c | 5 +++-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/m-array.h b/m-array.h index 6faa5594..59204da7 100644 --- a/m-array.h +++ b/m-array.h @@ -454,12 +454,6 @@ } \ \ static inline void \ - M_C3(array_,name, _remove)(array_t v, size_t i) \ - { \ - M_C3(array_, name, _pop_at)(NULL, v, i); \ - } \ - \ - static inline void \ M_C3(array_, name, _swap)(array_t v1, array_t v2) \ { \ ARRAYI_CONTRACT(v1); \ @@ -607,6 +601,12 @@ M_C3(array_, name, _push_at)(it->array, it->index, x); \ } \ \ + static inline void \ + M_C3(array_,name, _remove)(array_it_t it) \ + { \ + M_C3(array_, name, _pop_at)(NULL, it->array, it->index); \ + } \ + \ M_IF_METHOD(CMP, oplist) \ ( \ static inline void M_C3(array_, name, _sort)(array_t l, \ diff --git a/tests/test-marray.c b/tests/test-marray.c index c181e737..ba30f19d 100644 --- a/tests/test-marray.c +++ b/tests/test-marray.c @@ -260,10 +260,11 @@ static void test_d(void) for(int i = 10; i < 210; i++) { assert (*array_uint_get (a1, i) == 0); } - array_uint_remove (a1, 0); + array_it_uint_t it; + array_uint_it(it, a1); + array_uint_remove (it); assert (array_uint_size(a1) == 299); - array_it_uint_t it; array_uint_it_last (it, a1); assert (array_uint_last_p(it)); array_uint_it_end (it, a1);