diff options
| author | Tyge Løvset <[email protected]> | 2022-12-23 23:55:10 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-12-23 23:55:10 +0100 |
| commit | d623c6c85071b9af5d607bb5d9aceceaea05220a (patch) | |
| tree | f20fc3714f86e1553d1103bed6dc8efefcbd9d6b /misc/examples/rawptr_elements.c | |
| parent | 5f57d597cd27aef55adbcb3b452973b0c6e33667 (diff) | |
| download | STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.tar.gz STC-modified-d623c6c85071b9af5d607bb5d9aceceaea05220a.zip | |
Experimental uppercase macros.
Diffstat (limited to 'misc/examples/rawptr_elements.c')
| -rw-r--r-- | misc/examples/rawptr_elements.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/misc/examples/rawptr_elements.c b/misc/examples/rawptr_elements.c index 4b3d2056..05910c77 100644 --- a/misc/examples/rawptr_elements.c +++ b/misc/examples/rawptr_elements.c @@ -10,10 +10,10 @@ typedef int64_t inttype; #define i_key_str #define i_val inttype* #define i_valraw inttype -#define i_valfrom(raw) c_new(inttype, raw) +#define i_valfrom(raw) c_NEW(inttype, raw) #define i_valto(x) **x -#define i_valclone(x) c_new(inttype, *x) -#define i_valdrop(x) c_free(*x) +#define i_valclone(x) c_NEW(inttype, *x) +#define i_valdrop(x) c_FREE(*x) #include <stc/cmap.h> // With cbox: @@ -28,12 +28,12 @@ typedef int64_t inttype; int main() { - c_auto (SIPtrMap, map, m1) - c_auto (SIBoxMap, m2) + c_AUTO (SIPtrMap, map, m1) + c_AUTO (SIBoxMap, m2) { printf("\nMap with pointer elements:\n"); - SIPtrMap_insert(&map, cstr_from("testing"), c_new(inttype, 1)); - SIPtrMap_insert(&map, cstr_from("done"), c_new(inttype, 2)); + SIPtrMap_insert(&map, cstr_from("testing"), c_NEW(inttype, 1)); + SIPtrMap_insert(&map, cstr_from("done"), c_NEW(inttype, 2)); // Emplace: implicit key, val construction: SIPtrMap_emplace(&map, "hello", 3); @@ -41,14 +41,14 @@ int main() m1 = SIPtrMap_clone(map); - c_forpair (name, number, SIPtrMap, m1) + c_FORPAIR (name, number, SIPtrMap, m1) printf("%s: %" PRId64 "\n", cstr_str(_.name), **_.number); puts("\nIBox map:"); SIBoxMap_insert(&m2, cstr_from("Hello"), IBox_make(123)); SIBoxMap_emplace(&m2, "World", 999); - c_forpair (name, number, SIBoxMap, m2) + c_FORPAIR (name, number, SIBoxMap, m2) printf("%s: %d\n", cstr_str(_.name), *_.number->get); puts(""); } |
