summaryrefslogtreecommitdiffhomepage
path: root/examples/new_map.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/new_map.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/new_map.c')
-rw-r--r--examples/new_map.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/new_map.c b/examples/new_map.c
index 8975cd77..953ca793 100644
--- a/examples/new_map.c
+++ b/examples/new_map.c
@@ -16,15 +16,15 @@ struct MyStruct {
// Point => int map
struct Point { int x, y; } typedef Point;
-int point_compare(const Point* a, const Point* b) {
- int c = c_default_compare(&a->x, &b->x);
- return c ? c : c_default_compare(&a->y, &b->y);
+int point_cmp(const Point* a, const Point* b) {
+ int c = a->x - b->x;
+ return c ? c : a->y - b->y;
}
// Point => int map
#define i_key Point
#define i_val int
-#define i_cmp point_compare
+#define i_cmp point_cmp
#define i_opt c_is_fwd
#define i_tag pnt
#include <stc/cmap.h>