summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-05-15 15:47:58 +0200
committerTyge Løvset <[email protected]>2021-05-15 15:47:58 +0200
commit915ccf1d811ae9a0469cddd8f2dc6370e835e24b (patch)
tree81d82a35dacde0767a46317224343a82daef0fa7 /examples
parentac20f731153747ec5cbfc5566cc149485e20002a (diff)
downloadSTC-modified-915ccf1d811ae9a0469cddd8f2dc6370e835e24b.tar.gz
STC-modified-915ccf1d811ae9a0469cddd8f2dc6370e835e24b.zip
API change: Renamed c_init() to c_var() to better describe it declares and initializes a container variable. Will create a version 2.0 RC release soon.
Diffstat (limited to 'examples')
-rw-r--r--examples/csset_erase.c2
-rw-r--r--examples/inits.c4
-rw-r--r--examples/list_erase.c2
-rw-r--r--examples/list_splice.c4
-rw-r--r--examples/phonebook.c4
-rw-r--r--examples/words.c4
6 files changed, 10 insertions, 10 deletions
diff --git a/examples/csset_erase.c b/examples/csset_erase.c
index 1ddd8f03..53398ff9 100644
--- a/examples/csset_erase.c
+++ b/examples/csset_erase.c
@@ -5,7 +5,7 @@ using_csset(i, int);
int main()
{
- c_init(csset_i, set, {30, 20, 80, 40, 60, 90, 10, 70, 50});
+ c_var (csset_i, set, {30, 20, 80, 40, 60, 90, 10, 70, 50});
c_foreach (k, csset_i, set) printf(" %d", *k.ref); puts("");
int val = 64;
diff --git a/examples/inits.c b/examples/inits.c
index 003acfa3..c5190e75 100644
--- a/examples/inits.c
+++ b/examples/inits.c
@@ -80,7 +80,7 @@ int main(void)
// CVEC PAIR
- c_init (cvec_ip, pairs1, { {5, 6}, {3, 4}, {1, 2}, {7, 8} });
+ c_var (cvec_ip, pairs1, { {5, 6}, {3, 4}, {1, 2}, {7, 8} });
cvec_ip_sort(&pairs1);
c_foreach (i, cvec_ip, pairs1)
@@ -90,7 +90,7 @@ int main(void)
// CLIST PAIR
- c_init (clist_ip, pairs2, { {5, 6}, {3, 4}, {1, 2}, {7, 8} });
+ c_var (clist_ip, pairs2, { {5, 6}, {3, 4}, {1, 2}, {7, 8} });
clist_ip_sort(&pairs2);
c_foreach (i, clist_ip, pairs2)
diff --git a/examples/list_erase.c b/examples/list_erase.c
index 6e70b103..45947dee 100644
--- a/examples/list_erase.c
+++ b/examples/list_erase.c
@@ -6,7 +6,7 @@ using_clist(i, int);
int main ()
{
- c_init (clist_i, L, {10, 20, 30, 40, 50});
+ c_var (clist_i, L, {10, 20, 30, 40, 50});
// 10 20 30 40 50
clist_i_iter_t it = clist_i_begin(&L); // ^
clist_i_next(&it);
diff --git a/examples/list_splice.c b/examples/list_splice.c
index 06464c27..b8efa5db 100644
--- a/examples/list_splice.c
+++ b/examples/list_splice.c
@@ -14,8 +14,8 @@ void print_ilist(const char* s, clist_i list)
int main ()
{
- c_init (clist_i, list1, { 1, 2, 3, 4, 5 });
- c_init (clist_i, list2, { 10, 20, 30, 40, 50 });
+ c_var (clist_i, list1, { 1, 2, 3, 4, 5 });
+ c_var (clist_i, list2, { 10, 20, 30, 40, 50 });
clist_i_iter_t it = clist_i_fwd(clist_i_begin(&list1), 2);
it = clist_i_splice(&list1, it, &list2);
diff --git a/examples/phonebook.c b/examples/phonebook.c
index 72ce11f2..335679e3 100644
--- a/examples/phonebook.c
+++ b/examples/phonebook.c
@@ -39,11 +39,11 @@ int main(int argc, char **argv)
{
c_static_assert(3 == 3, "hello");
- c_init (cset_str, names, {"Hello", "Cool", "True"});
+ c_var (cset_str, names, {"Hello", "Cool", "True"});
c_foreach (i, cset_str, names) printf("set: %s\n", i.ref->str);
bool erased;
- c_init (cmap_str, phone_book, {
+ c_var (cmap_str, phone_book, {
{"Lilia Friedman", "(892) 670-4739"},
{"Tariq Beltran", "(489) 600-7575"},
{"Laiba Juarez", "(303) 885-5692"},
diff --git a/examples/words.c b/examples/words.c
index 4b8bd11b..1edb1483 100644
--- a/examples/words.c
+++ b/examples/words.c
@@ -11,7 +11,7 @@ using_cmap_strkey(si, int);
int main1()
{
- c_init (clist_str, lwords, {
+ c_var (clist_str, lwords, {
"this", "sentence", "is", "not", "a", "sentence",
"this", "sentence", "is", "a", "hoax"
});
@@ -21,7 +21,7 @@ int main1()
printf("%s\n", w.ref->str);
puts("");
- c_init (cvec_str, words, {
+ c_var (cvec_str, words, {
"this", "sentence", "is", "not", "a", "sentence",
"this", "sentence", "is", "a", "hoax"
});