summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Lovset <[email protected]>2022-04-18 12:12:01 +0200
committerTyge Lovset <[email protected]>2022-04-18 12:12:01 +0200
commitb0d60c33a073782fe0bb08c835ca9db0b94145d0 (patch)
tree1683369ec66467720502b3d904bf9ab11343076e /examples
parent00804d9ff488f63468a0bb528c7b807aea7c3ea3 (diff)
downloadSTC-modified-b0d60c33a073782fe0bb08c835ca9db0b94145d0.tar.gz
STC-modified-b0d60c33a073782fe0bb08c835ca9db0b94145d0.zip
Removed i_drop and i_from template specifiers to reduce redundancies and add clarity (error given if used): use i_valdrop/i_valfrom and i_keydrop/i_keyfrom instead.
Added missing at_mut() function to cdeq.
Diffstat (limited to 'examples')
-rw-r--r--examples/arc_containers.c2
-rw-r--r--examples/arc_demo.c2
-rw-r--r--examples/arcvec_erase.c2
-rw-r--r--examples/box2.c2
-rw-r--r--examples/complex.c4
-rw-r--r--examples/mapmap.c4
-rw-r--r--examples/music_arc.c2
-rw-r--r--examples/new_sptr.c2
-rw-r--r--examples/rawptr_elements.c2
9 files changed, 11 insertions, 11 deletions
diff --git a/examples/arc_containers.c b/examples/arc_containers.c
index 53297270..cd049c4d 100644
--- a/examples/arc_containers.c
+++ b/examples/arc_containers.c
@@ -8,7 +8,7 @@
#define i_type Arc // (atomic) ref. counted type
#define i_val Map
-#define i_drop(p) (printf("drop Arc:\n"), Map_drop(p))
+#define i_valdrop(p) (printf("drop Arc:\n"), Map_drop(p))
// no need for atomic ref. count in single thread:
// no compare function available for csmap:
#define i_opt c_no_atomic|c_no_cmp
diff --git a/examples/arc_demo.c b/examples/arc_demo.c
index 036b7a00..12f81b8d 100644
--- a/examples/arc_demo.c
+++ b/examples/arc_demo.c
@@ -10,7 +10,7 @@ void int_drop(int* x) {
#define i_type iref // set type name to be defined (instead of 'carc_int')
#define i_val int
-#define i_drop int_drop // optional, just to display the elements destroyed
+#define i_valdrop int_drop // optional, just to display the elements destroyed
#include <stc/carc.h> // iref
#define i_key_arcbox iref // note: use i_key_bind instead of i_key for carc/cbox elements
diff --git a/examples/arcvec_erase.c b/examples/arcvec_erase.c
index 12547f6c..10d8d4c0 100644
--- a/examples/arcvec_erase.c
+++ b/examples/arcvec_erase.c
@@ -4,7 +4,7 @@ void show_drop(int* x) { printf("drop: %d\n", *x); }
#define i_type Arc
#define i_val int
-#define i_drop show_drop
+#define i_valdrop show_drop
// carc/cbox will use pointer address comparison of i_val
// if 'i_opt c_no_cmp' is defined, otherwise i_cmp is used
// to compare object values. See the two differences by
diff --git a/examples/box2.c b/examples/box2.c
index 68a9ccba..6d118e2c 100644
--- a/examples/box2.c
+++ b/examples/box2.c
@@ -27,7 +27,7 @@ struct {
// Box in box:
#define i_val_arcbox cbox_Point // NB: use i_val_arcbox when value is a cbox or carc!
- // it will auto-set i_drop, i_from, i_cmp for you.
+ // it will auto-set i_valdrop, i_valfrom, i_cmp for you.
#define i_opt c_no_cmp
#define i_tag BoxPoint
#include <stc/cbox.h> // cbox_BoxPoint
diff --git a/examples/complex.c b/examples/complex.c
index 9ccd2dae..ef7f711f 100644
--- a/examples/complex.c
+++ b/examples/complex.c
@@ -4,8 +4,8 @@ void check_drop(float* v) {printf("destroy %g\n", *v);}
#define i_type FloatStack
#define i_val float
-#define i_drop check_drop
-#define i_from c_default_from
+#define i_valdrop check_drop
+#define i_valfrom c_default_from
#include <stc/cstack.h>
#define i_type StackList
diff --git a/examples/mapmap.c b/examples/mapmap.c
index 7faaffd1..94b92a81 100644
--- a/examples/mapmap.c
+++ b/examples/mapmap.c
@@ -16,8 +16,8 @@
// Shorthand for:
//#define i_val People_value
//#define i_cmp People_value_cmp
-//#define i_from People_value_clone
-//#define i_drop People_value_drop
+//#define i_valfrom People_value_clone
+//#define i_valdrop People_value_drop
#include <stc/cvec.h>
void add(Departments* deps, const char* name, const char* email, const char* dep)
diff --git a/examples/music_arc.c b/examples/music_arc.c
index b8525022..e36477f2 100644
--- a/examples/music_arc.c
+++ b/examples/music_arc.c
@@ -19,7 +19,7 @@ void Song_drop(Song* s) {
#define i_type SongPtr
#define i_val Song
-#define i_drop Song_drop
+#define i_valdrop Song_drop
#define i_opt c_no_cmp
#include <stc/carc.h>
diff --git a/examples/new_sptr.c b/examples/new_sptr.c
index 2fb058df..2c2c5d8a 100644
--- a/examples/new_sptr.c
+++ b/examples/new_sptr.c
@@ -22,7 +22,7 @@ void Person_drop(Person* p) {
// ...
#define i_type SPtr
#define i_val int
-#define i_drop(x) printf("drop: %d\n", *(x))
+#define i_valdrop(x) printf("drop: %d\n", *(x))
#include <stc/carc.h>
#define i_val_arcbox SPtr
diff --git a/examples/rawptr_elements.c b/examples/rawptr_elements.c
index 8f7dd4de..b0878941 100644
--- a/examples/rawptr_elements.c
+++ b/examples/rawptr_elements.c
@@ -16,8 +16,8 @@ struct { double x, y; } typedef Point;
// Map of int64 pointers: For fun, define valraw as int64_t for easy emplace call!
typedef int64_t inttype;
#define i_key_str
-#define i_valraw inttype
#define i_val inttype*
+#define i_valraw inttype
#define i_valdrop(x) c_free(*(x))
#define i_valfrom(raw) c_new(inttype, raw)
#define i_valto(x) **(x)