summaryrefslogtreecommitdiffhomepage
path: root/examples/multimap.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-12-19 12:21:44 +0100
committerTyge Løvset <[email protected]>2021-12-19 12:21:44 +0100
commit92b950333c6c7002bdbf1b60af44a249dc0cef9c (patch)
tree4b1acfcdba0bd940f829c53910587e27b5e0af90 /examples/multimap.c
parent183a89859ba9914ee0546e4482b40be199e52292 (diff)
downloadSTC-modified-92b950333c6c7002bdbf1b60af44a249dc0cef9c.tar.gz
STC-modified-92b950333c6c7002bdbf1b60af44a249dc0cef9c.zip
First commit for Version 3 of STC. Main changes are consistent rename of '_del' to '_drop' and '_compare' to '_cmp'.
Also i_key_ref (earlier i_key_sptr) and i_val_ref replaced by more general i_key_bind/i_val_bind.
Diffstat (limited to 'examples/multimap.c')
-rw-r--r--examples/multimap.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/multimap.c b/examples/multimap.c
index 543b8b22..424ae606 100644
--- a/examples/multimap.c
+++ b/examples/multimap.c
@@ -35,7 +35,7 @@ struct OlympicsData { int year; const char *city, *country, *date; } ol_data[] =
typedef struct { int year; cstr city, date; } OlympicLocation;
-int OlympicLocation_compare(OlympicLocation* a, OlympicLocation* b) {
+int OlympicLocation_cmp(OlympicLocation* a, OlympicLocation* b) {
return a->year - b->year;
}
@@ -44,14 +44,14 @@ OlympicLocation OlympicLocation_clone(OlympicLocation loc) {
loc.date = cstr_clone(loc.date);
return loc;
}
-void OlympicLocation_del(OlympicLocation* self) {
- c_del(cstr, &self->city, &self->date);
+void OlympicLocation_drop(OlympicLocation* self) {
+ c_drop(cstr, &self->city, &self->date);
}
// Create a clist<OlympicLocation>, can be sorted by year.
#define i_val OlympicLocation
-#define i_cmp OlympicLocation_compare
-#define i_del OlympicLocation_del
+#define i_cmp OlympicLocation_cmp
+#define i_drop OlympicLocation_drop
#define i_from OlympicLocation_clone
#define i_tag OL
#include <stc/clist.h>
@@ -59,7 +59,7 @@ void OlympicLocation_del(OlympicLocation* self) {
// Create a csmap<cstr, clist_OL> where key is country name
#define i_key_str
#define i_val clist_OL
-#define i_valdel clist_OL_del
+#define i_valdrop clist_OL_drop
#define i_valfrom clist_OL_clone
#define i_tag OL
#include <stc/csmap.h>