From 7abea5ab04bffebbedfad7bd8d9c5c26170d19af Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Fri, 6 Jan 2023 11:40:41 +0100 Subject: Removed swap() function from all containers. Use safe c_SWAP() macro instead. --- misc/archived/csmap.h | 1 - misc/examples/lower_bound.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'misc') diff --git a/misc/archived/csmap.h b/misc/archived/csmap.h index 8b182e70..5c9fba6b 100644 --- a/misc/archived/csmap.h +++ b/misc/archived/csmap.h @@ -113,7 +113,6 @@ STC_API void _cx_memb(_next)(_cx_iter* it); STC_INLINE bool _cx_memb(_empty)(_cx_self cx) { return cx.size == 0; } STC_INLINE size_t _cx_memb(_size)(_cx_self cx) { return cx.size; } -STC_INLINE void _cx_memb(_swap)(_cx_self* a, _cx_self* b) { c_SWAP(_cx_self, *a, *b); } STC_INLINE _cx_iter _cx_memb(_find)(const _cx_self* self, i_keyraw rkey) { _cx_iter it; _cx_memb(_find_it)(self, rkey, &it); return it; } STC_INLINE bool _cx_memb(_contains)(const _cx_self* self, i_keyraw rkey) diff --git a/misc/examples/lower_bound.c b/misc/examples/lower_bound.c index dde9d93a..8d048e7c 100644 --- a/misc/examples/lower_bound.c +++ b/misc/examples/lower_bound.c @@ -25,12 +25,12 @@ int main() key = 10; cvec_int_iter it1 = cvec_int_lower_bound(&vec, key); - if (res) + if (it1.ref) printf("Sorted Vec %3d: lower_bound: %d\n", key, *it1.ref); // 30 key = 600; cvec_int_iter it2 = cvec_int_binary_search(&vec, key); - if (res) + if (it2.ref) printf("Sorted Vec %d: bin. search: %d\n", key, *it2.ref); // 600 c_FOREACH (i, cvec_int, it1, it2) @@ -54,12 +54,12 @@ int main() key = 10; csset_int_iter it1 = csset_int_lower_bound(&set, key); - if (res) + if (it1.ref) printf("Sorted Set %3d: lower bound: %d\n", key, *it1.ref); // 30 key = 600; csset_int_iter it2 = csset_int_find(&set, key); - if (res) + if (it2.ref) printf("Sorted Set %d: find : %d\n", key, *it2.ref); // 600 c_FOREACH (i, csset_int, it1, it2) -- cgit v1.2.3