summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-09-14 09:12:26 +0200
committerTyge Løvset <[email protected]>2020-09-14 09:12:26 +0200
commit1dd8d2ef2b5fd86bd500ab01c52f7e4a3bd9df60 (patch)
tree6712e46fb4d23bb30f88e9915c73e79090fa7454 /examples
parent58cb39e99704606d4523b4e523fc3820b8ac37c2 (diff)
downloadSTC-modified-1dd8d2ef2b5fd86bd500ab01c52f7e4a3bd9df60.tar.gz
STC-modified-1dd8d2ef2b5fd86bd500ab01c52f7e4a3bd9df60.zip
Renamed in cmap.
Diffstat (limited to 'examples')
-rw-r--r--examples/demos.c18
-rw-r--r--examples/geek2.c6
-rw-r--r--examples/geek6.c2
3 files changed, 13 insertions, 13 deletions
diff --git a/examples/demos.c b/examples/demos.c
index 0fa6f5e2..7b204aa1 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -106,11 +106,11 @@ void setdemo1()
{
printf("\nSETDEMO1\n");
cset_i nums = cset_ini;
- cset_i_put(&nums, 8);
- cset_i_put(&nums, 11);
+ cset_i_insert(&nums, 8);
+ cset_i_insert(&nums, 11);
c_foreach (i, cset_i, nums)
- printf("set: %d\n", i.item->key);
+ printf("set: %d\n", i.item->value);
cset_i_destroy(&nums);
}
@@ -140,11 +140,11 @@ void mapdemo2()
// iterate the map:
for (cmap_si_iter_t i = cmap_si_begin(&nums); i.item != cmap_si_end(&nums).item; cmap_si_next(&i))
- printf("long: %s: %d\n", i.item->key.str, i.item->value);
+ printf("long: %s: %d\n", i.item->first.str, i.item->second);
// or rather use the short form:
c_foreach (i, cmap_si, nums)
- printf("short: %s: %d\n", i.item->key.str, i.item->value);
+ printf("short: %s: %d\n", i.item->first.str, i.item->second);
cmap_si_destroy(&nums);
}
@@ -159,15 +159,15 @@ void mapdemo3()
cmap_str_put(&table, "Map", "test");
cmap_str_put(&table, "Make", "my");
cmap_str_put(&table, "Sunny", "day");
- cmap_str_entry_t *e = cmap_str_find(&table, "Make");
+ cmap_str_value_t *e = cmap_str_find(&table, "Make");
c_foreach (i, cmap_str, table)
- printf("entry: %s: %s\n", i.item->key.str, i.item->value.str);
- printf("size %zu: remove: Make: %s\n", cmap_size(table), e->value.str);
+ printf("entry: %s: %s\n", i.item->first.str, i.item->second.str);
+ printf("size %zu: remove: Make: %s\n", cmap_size(table), e->second.str);
cmap_str_erase(&table, "Make");
printf("size %zu\n", cmap_size(table));
c_foreach (i, cmap_str, table)
- printf("entry: %s: %s\n", i.item->key.str, i.item->value.str);
+ printf("entry: %s: %s\n", i.item->first.str, i.item->second.str);
cmap_str_destroy(&table); // frees key and value CStrs, and hash table (CVec).
}
diff --git a/examples/geek2.c b/examples/geek2.c
index b65f097d..c76d262f 100644
--- a/examples/geek2.c
+++ b/examples/geek2.c
@@ -12,9 +12,9 @@ int main()
// be `cmap<String, String>` in this example).
cmap_str book_reviews = cmap_ini;
cset_str set = cset_ini;
- cset_str_put(&set, "Hello");
- cset_str_put(&set, "You");
- cset_str_put(&set, "Tube");
+ cset_str_insert(&set, "Hello");
+ cset_str_insert(&set, "You");
+ cset_str_insert(&set, "Tube");
c_foreach (i, cset_str, set)
printf("%s ", i.item->key.str);
puts("");
diff --git a/examples/geek6.c b/examples/geek6.c
index e906600f..badf5bbc 100644
--- a/examples/geek6.c
+++ b/examples/geek6.c
@@ -43,7 +43,7 @@ int missingNumber(int a[], int n)
// store it in map
for (int i = 0; i < n; i++) {
if (a[i] > 0)
- cset_i_put(&mp, a[i]);
+ cset_i_insert(&mp, a[i]);
}
// index value set to 1