summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/multimap.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
committerTyge Løvset <[email protected]>2022-12-23 23:55:10 +0100
commitd623c6c85071b9af5d607bb5d9aceceaea05220a (patch)
treef20fc3714f86e1553d1103bed6dc8efefcbd9d6b /misc/examples/multimap.c
parent5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff)
downloadSTC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz
STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip
Experimental uppercase macros.
Diffstat (limited to 'misc/examples/multimap.c')
-rw-r--r--misc/examples/multimap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/misc/examples/multimap.c b/misc/examples/multimap.c
index e72bdce3..8797c24e 100644
--- a/misc/examples/multimap.c
+++ b/misc/examples/multimap.c
@@ -60,17 +60,17 @@ OlympicLocation OlympicLocation_clone(OlympicLocation loc) {
return loc;
}
void OlympicLocation_drop(OlympicLocation* self) {
- c_drop(cstr, &self->city, &self->date);
+ c_DROP(cstr, &self->city, &self->date);
}
int main()
{
// Define the multimap with destructor defered to when block is completed.
- c_auto (csmap_OL, multimap)
+ c_AUTO (csmap_OL, multimap)
{
const clist_OL empty = clist_OL_init();
- for (size_t i = 0; i < c_arraylen(ol_data); ++i)
+ for (size_t i = 0; i < c_ARRAYLEN(ol_data); ++i)
{
struct OlympicsData* d = &ol_data[i];
OlympicLocation loc = {.year = d->year,
@@ -82,14 +82,14 @@ int main()
clist_OL_push_back(list, loc);
}
// Sort locations by year for each country.
- c_foreach (country, csmap_OL, multimap)
+ c_FOREACH (country, csmap_OL, multimap)
clist_OL_sort(&country.ref->second);
// Print the multimap:
- c_foreach (country, csmap_OL, multimap)
+ c_FOREACH (country, csmap_OL, multimap)
{
// Loop the locations for a country sorted by year
- c_foreach (loc, clist_OL, country.ref->second)
+ c_FOREACH (loc, clist_OL, country.ref->second)
printf("%s: %d, %s, %s\n", cstr_str(&country.ref->first),
loc.ref->year,
cstr_str(&loc.ref->city),