summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--examples/README.md4
-rw-r--r--examples/advanced.c2
-rw-r--r--examples/inits.c12
-rw-r--r--examples/list.c2
-rw-r--r--examples/phonebook.c2
-rw-r--r--examples/priority.c2
-rw-r--r--examples/words.c4
-rw-r--r--stc/cdefs.h2
-rw-r--r--stc/cmap.h2
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; i<N; ++i)
cpqueue_i_push(&heap, crand_uniform_i64(&pcg, &dist));
diff --git a/examples/words.c b/examples/words.c
index d720fa0e..fe738d0d 100644
--- a/examples/words.c
+++ b/examples/words.c
@@ -12,7 +12,7 @@ c_cmap_strkey(si, int);
int main1()
{
clist_str lwords = clist_ini;
- c_push(&lwords, clist_str, {
+ c_push_items(&lwords, clist_str, {
"this", "sentence", "is", "not", "a", "sentence",
"this", "sentence", "is", "a", "hoax"
});
@@ -22,7 +22,7 @@ int main1()
puts("");
cvec_str words = cvec_ini;
- c_push(&words, cvec_str, {
+ c_push_items(&words, cvec_str, {
"this", "sentence", "is", "not", "a", "sentence",
"this", "sentence", "is", "a", "hoax"
});
diff --git a/stc/cdefs.h b/stc/cdefs.h
index df56987e..ef6fd62f 100644
--- a/stc/cdefs.h
+++ b/stc/cdefs.h
@@ -85,7 +85,7 @@
#define c_foreach_4(it, ctype, start, finish) \
for (ctype##_iter_t it = start, it##_end_ = finish; it.get != it##_end_.get; ctype##_next(&it))
-#define c_push(self, ctype, ...) do { \
+#define c_push_items(self, ctype, ...) do { \
const ctype##_input_t __arr[] = __VA_ARGS__; \
ctype##_push_n(self, __arr, sizeof(__arr)/sizeof(__arr[0])); \
} while (0)
diff --git a/stc/cmap.h b/stc/cmap.h
index fcdfc3a4..5f18bb00 100644
--- a/stc/cmap.h
+++ b/stc/cmap.h
@@ -65,7 +65,7 @@ int main(void) {
ctype##_result_t __r = ctype##_insert_key_(self, key); \
if (__r.second) __r.first->second = 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<sizeof(__arr)/sizeof(__arr[0]); ++i) ctype##_insert(self, __arr[i]); \
} while (0)