From d3d68271e1c4ff0f56d06730f79349197f46850c Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 16 Sep 2020 09:11:39 +0200 Subject: Renamed two public macros. --- README.md | 4 ++-- examples/README.md | 4 ++-- examples/advanced.c | 2 +- examples/inits.c | 12 ++++++------ examples/list.c | 2 +- examples/phonebook.c | 2 +- examples/priority.c | 2 +- examples/words.c | 4 ++-- stc/cdefs.h | 2 +- stc/cmap.h | 2 +- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 9184a2e4..07ef79ff 100644 --- a/README.md +++ b/README.md @@ -299,8 +299,8 @@ int main() { clist_fx_clear(&list); - // generic c_push() function, works on most containers: - c_push(&list, clist_fx, {10, 20, 30, 40, 50}); + // generic c_push_items() function, works on most containers: + c_push_items(&list, clist_fx, {10, 20, 30, 40, 50}); c_foreach (i, clist_fx, list) printf("%f ", i.get->value); diff --git a/examples/README.md b/examples/README.md index 98e366df..d12cc522 100644 --- a/examples/README.md +++ b/examples/README.md @@ -57,11 +57,11 @@ c_cmap(vk, Viking, int, c_default_destroy, vikingvw_equals, vikingvw_hash, viking_destroy, VikingVw, viking_toVw, viking_fromVw); ``` cmap_vk uses vikingvw_hash() for hash value calculations, and vikingvw_equals() for equality test. cmap_vk_destroy() will free all memory allocated for Viking keys and the hash table values. -Finally, main which also demos the generic c_push() of multiple elements: +Finally, main which also demos the generic c_push_items() of multiple elements: ``` int main() { cmap_vk vikings = cmap_ini; - c_push(&vikings, cmap_vk, { + c_push_items(&vikings, cmap_vk, { { {"Einar", "Norway"}, 20 }, { {"Olaf", "Denmark"}, 24 }, { {"Harald", "Iceland"}, 12 }, diff --git a/examples/advanced.c b/examples/advanced.c index c48c25a2..0570ce55 100644 --- a/examples/advanced.c +++ b/examples/advanced.c @@ -62,7 +62,7 @@ c_cmap(vk, Viking, int, c_default_destroy, vikingvw_equals, vikingvw_hash, int main() { cmap_vk vikings = cmap_ini; - c_push(&vikings, cmap_vk, { + c_push_items(&vikings, cmap_vk, { {{"Einar", "Norway"}, 20}, {{"Olaf", "Denmark"}, 24}, {{"Harald", "Iceland"}, 12}, diff --git a/examples/inits.c b/examples/inits.c index 1bd6e5f4..6540290a 100644 --- a/examples/inits.c +++ b/examples/inits.c @@ -25,7 +25,7 @@ int main(void) { // CVEC FLOAT / PRIORITY QUEUE cvec_f floats = cvec_ini; - c_push(&floats, cvec_f, {4.0f, 2.0f, 5.0f, 3.0f, 1.0f}); + c_push_items(&floats, cvec_f, {4.0f, 2.0f, 5.0f, 3.0f, 1.0f}); c_foreach (i, cvec_f, floats) printf("%.1f ", *i.get); puts(""); @@ -33,7 +33,7 @@ int main(void) { // CVEC PRIORITY QUEUE cpqueue_f_build(&floats); // reorganise vec - c_push(&floats, cpqueue_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f}); + c_push_items(&floats, cpqueue_f, {40.0f, 20.0f, 50.0f, 30.0f, 10.0f}); // sorted: while (cvec_size(floats) > 0) { @@ -47,7 +47,7 @@ int main(void) { int year = 2020; cmap_id idnames = cmap_ini; - c_push(&idnames, cmap_id, { + c_push_items(&idnames, cmap_id, { {100, cstr("Hello")}, {110, cstr("World")}, {120, cstr_from("Howdy, -%d-", year)}, @@ -61,7 +61,7 @@ int main(void) { // CMAP CNT cmap_cnt countries = cmap_ini; - c_push(&countries, cmap_cnt, { + c_push_items(&countries, cmap_cnt, { {"Norway", 100}, {"Denmark", 50}, {"Iceland", 10}, @@ -84,7 +84,7 @@ int main(void) { // CVEC PAIR cvec_ip pairs1 = cvec_ini; - c_push(&pairs1, cvec_ip, { + c_push_items(&pairs1, cvec_ip, { {5, 6}, {3, 4}, {1, 2}, @@ -100,7 +100,7 @@ int main(void) { // CLIST PAIR clist_ip pairs2 = clist_ini; - c_push(&pairs2, clist_ip, { + c_push_items(&pairs2, clist_ip, { {5, 6}, {3, 4}, {1, 2}, diff --git a/examples/list.c b/examples/list.c index cea8c7f6..a0a3b456 100644 --- a/examples/list.c +++ b/examples/list.c @@ -23,7 +23,7 @@ int main() { puts(""); clist_fx_clear(&list); - c_push(&list, clist_fx, {10, 20, 30, 40, 30, 50}); + c_push_items(&list, clist_fx, {10, 20, 30, 40, 30, 50}); c_foreach (i, clist_fx, list) printf(" %g", i.get->value); puts(""); diff --git a/examples/phonebook.c b/examples/phonebook.c index 9cc9245f..5395d774 100644 --- a/examples/phonebook.c +++ b/examples/phonebook.c @@ -37,7 +37,7 @@ int main(int argc, char **argv) { bool erased; cmap_str phone_book = cmap_ini; - c_push(&phone_book, cmap_str, { + c_push_items(&phone_book, cmap_str, { {"Lilia Friedman", "(892) 670-4739"}, {"Tariq Beltran", "(489) 600-7575"}, {"Laiba Juarez", "(303) 885-5692"}, diff --git a/examples/priority.c b/examples/priority.c index 6e39e63b..1a8eff78 100644 --- a/examples/priority.c +++ b/examples/priority.c @@ -20,7 +20,7 @@ int main() { cpqueue_i_push(&heap, crand_uniform_i64(&pcg, &dist)); // push some negative numbers too. - c_push(&heap, cpqueue_i, {-231, -32, -873, -4, -343}); + c_push_items(&heap, cpqueue_i, {-231, -32, -873, -4, -343}); for (int i=0; isecond = val; \ } while (0) -#define c_insert(self, ctype, ...) do { \ +#define c_insert_items(self, ctype, ...) do { \ const ctype##_input_t __arr[] = __VA_ARGS__; \ for (size_t i=0;i