diff options
| author | Tyge Løvset <[email protected]> | 2023-02-08 16:16:49 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-08 17:18:24 +0100 |
| commit | c4441f5fc665194fbd7a894a67a64a08c3beac42 (patch) | |
| tree | 82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/examples/arc_demo.c | |
| parent | 673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff) | |
| download | STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip | |
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/examples/arc_demo.c')
| -rw-r--r-- | misc/examples/arc_demo.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/arc_demo.c b/misc/examples/arc_demo.c index 564ebd6d..867cfc83 100644 --- a/misc/examples/arc_demo.c +++ b/misc/examples/arc_demo.c @@ -22,19 +22,19 @@ void int_drop(int* x) { int main() { - c_AUTO (cvec_Arc, vec) // declare and init vec, call cvec_Arc_drop() at scope exit - c_AUTO (csset_Arc, set) // declare and init set, call csset_Arc_drop() at scope exit + c_auto (cvec_Arc, vec) // declare and init vec, call cvec_Arc_drop() at scope exit + c_auto (csset_Arc, set) // declare and init set, call csset_Arc_drop() at scope exit { const int years[] = {2021, 2012, 2022, 2015}; - c_FORRANGE (i, c_ARRAYLEN(years)) + c_forrange (i, c_ARRAYLEN(years)) cvec_Arc_push(&vec, Arc_from(years[i])); printf("vec:"); - c_FOREACH (i, cvec_Arc, vec) printf(" %d", *i.ref->get); + c_foreach (i, cvec_Arc, vec) printf(" %d", *i.ref->get); puts(""); // add odd numbers from vec to set - c_FOREACH (i, cvec_Arc, vec) + c_foreach (i, cvec_Arc, vec) if (*i.ref->get & 1) csset_Arc_insert(&set, Arc_clone(*i.ref)); // copy shared pointer => increments counter. @@ -43,12 +43,12 @@ int main() cvec_Arc_pop_back(&vec); printf("vec:"); - c_FOREACH (i, cvec_Arc, vec) printf(" %d", *i.ref->get); + c_foreach (i, cvec_Arc, vec) printf(" %d", *i.ref->get); printf("\nset:"); - c_FOREACH (i, csset_Arc, set) printf(" %d", *i.ref->get); + c_foreach (i, csset_Arc, set) printf(" %d", *i.ref->get); - c_WITH (Arc p = Arc_clone(vec.data[0]), Arc_drop(&p)) { + c_with (Arc p = Arc_clone(vec.data[0]), Arc_drop(&p)) { printf("\n%d is now owned by %ld objects\n", *p.get, *p.use_count); } |
