summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-07-30 21:26:30 +0200
committerTyge Løvset <[email protected]>2020-07-30 21:26:30 +0200
commit70f8b86fce862912fc9a9a79cb9406263dacad8f (patch)
treeb8764d89abe33360c98d251fd595f0b0dd84c636 /examples
parentf676c271617ccd8b4b3689bfb7bbf06fe7542189 (diff)
downloadSTC-modified-70f8b86fce862912fc9a9a79cb9406263dacad8f.tar.gz
STC-modified-70f8b86fce862912fc9a9a79cb9406263dacad8f.zip
Got rid of cmapentry_ii. use cmap_ii_entry_t and cmap_ii_entry_destroy().
Diffstat (limited to 'examples')
-rw-r--r--examples/README.md2
-rw-r--r--examples/advanced.c2
-rw-r--r--examples/demos.c2
-rw-r--r--examples/geek1.c4
-rw-r--r--examples/geek2.c2
-rw-r--r--examples/geek4.c4
-rw-r--r--examples/geek5.c4
-rw-r--r--examples/geek7.c2
8 files changed, 11 insertions, 11 deletions
diff --git a/examples/README.md b/examples/README.md
index ededc828..d4d7dd3f 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -74,7 +74,7 @@ int main()
cmap_vk_put(&vikings, (VikingVw) {"Olaf", "Denmark"}, 24);
cmap_vk_put(&vikings, (VikingVw) {"Harald", "Iceland"}, 12);
- cmapentry_vk* e = cmap_vk_get(&vikings, (VikingVw) {"Einar", "Norway"});
+ cmap_vk_entry_t* e = cmap_vk_get(&vikings, (VikingVw) {"Einar", "Norway"});
e->value += 5; // update
c_foreach (k, cmap_vk, vikings) {
diff --git a/examples/advanced.c b/examples/advanced.c
index e57738cc..90ec7cc0 100644
--- a/examples/advanced.c
+++ b/examples/advanced.c
@@ -70,7 +70,7 @@ int main()
{{"Harald", "Iceland"}, 12},
));
VikingVw look = {"Einar", "Norway"};
- cmapentry_vk* e = cmap_vk_find(&vikings, look);
+ cmap_vk_entry_t *e = cmap_vk_find(&vikings, look);
e->value += 5; // update
cmap_vk_insert(&vikings, look, 0)->value += 5; // again
diff --git a/examples/demos.c b/examples/demos.c
index 3c7ac5f4..35581cf6 100644
--- a/examples/demos.c
+++ b/examples/demos.c
@@ -159,7 +159,7 @@ void mapdemo3()
cmap_ss_put(&table, "Map", cstr_make("test"));
cmap_ss_put(&table, "Make", cstr_make("my"));
cmap_ss_put(&table, "Sunny", cstr_make("day"));
- cmapentry_ss *e = cmap_ss_find(&table, "Make");
+ cmap_ss_entry_t *e = cmap_ss_find(&table, "Make");
c_foreach (i, cmap_ss, 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);
diff --git a/examples/geek1.c b/examples/geek1.c
index c780a9ea..44824978 100644
--- a/examples/geek1.c
+++ b/examples/geek1.c
@@ -38,8 +38,8 @@ int findMaximumPairs(int a[], int n, int k)
int first = it.item->key;
int second = k - it.item->key;
- cmapentry_ii *hf = cmap_ii_find(&hash, first),
- *hs = cmap_ii_insert(&hash, second, 0);
+ cmap_ii_entry_t *hf = cmap_ii_find(&hash, first),
+ *hs = cmap_ii_insert(&hash, second, 0);
// Check for minimal occurrence
if (hf->value < hs->value) {
// Take the minimal
diff --git a/examples/geek2.c b/examples/geek2.c
index cb4b45ee..9b2785f1 100644
--- a/examples/geek2.c
+++ b/examples/geek2.c
@@ -50,7 +50,7 @@ int main()
// Look up the values associated with some keys.
const char* to_find[] = {"Pride and Prejudice", "Alice's Adventure in Wonderland", NULL};
for (const char** book = to_find; *book; ++book) {
- cmapentry_ss* review = cmap_ss_find(&book_reviews, *book);
+ cmap_ss_entry_t *review = cmap_ss_find(&book_reviews, *book);
if (review) printf("%s: %s\n", *book, review->value.str);
else printf("%s is unreviewed.\n", *book);
}
diff --git a/examples/geek4.c b/examples/geek4.c
index cef28ee7..3672563d 100644
--- a/examples/geek4.c
+++ b/examples/geek4.c
@@ -39,7 +39,7 @@ Efficient Approach: For all the words of the first sentence, we can check if it
declare_cvec_str();
declare_cmap_str(sb, bool);
-declare_cvec(sb, cmapentry_sb, cmapentry_sb_destroy, c_no_compare);
+declare_cvec(sb, cmap_sb_entry_t, cmap_sb_entry_destroy, c_no_compare);
// Function to return the count of common words
// in all the sentences
@@ -60,7 +60,7 @@ int commonWords(cvec_str S)
while (i < cstr_size(S.data[0])) {
// To store separate words
cstr_t word = cstr_init;
- cmapentry_sb tmp = {cstr_init, false};
+ cmap_sb_entry_t tmp = {cstr_init, false};
while (i < cstr_size(S.data[0]) && S.data[0].str[i] != ' ') {
cstr_push_back(&word, S.data[0].str[i]);
diff --git a/examples/geek5.c b/examples/geek5.c
index eef27c19..67f5d097 100644
--- a/examples/geek5.c
+++ b/examples/geek5.c
@@ -32,7 +32,7 @@ int NumOccurrences(const char* arr[], int n, const char* str, int L, int R)
cmap_sv M = cmap_init;
for (int i = 0; i < n; i++) {
const char* temp = arr[i];
- cmapentry_sv* it = cmap_sv_find(&M, temp);
+ cmap_sv_entry_t *it = cmap_sv_find(&M, temp);
// If current string doesn't
// have an entry in the map
@@ -47,7 +47,7 @@ int NumOccurrences(const char* arr[], int n, const char* str, int L, int R)
}
}
- cmapentry_sv* it = cmap_sv_find(&M, str);
+ cmap_sv_entry_t *it = cmap_sv_find(&M, str);
// If the given string is not
// present in the array
diff --git a/examples/geek7.c b/examples/geek7.c
index 16e70e98..58fadcae 100644
--- a/examples/geek7.c
+++ b/examples/geek7.c
@@ -48,7 +48,7 @@ void findElementsAfterDel(int arr[], int m, int del[],
for (int i = 0; i < m; ++i) {
// Search if the element is present
- cmapentry_ii *e = cmap_ii_find(&mp, arr[i]);
+ cmap_ii_entry_t *e = cmap_ii_find(&mp, arr[i]);
if (e != NULL) {
// Decrement its frequency