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/list_splice.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/list_splice.c')
| -rw-r--r-- | misc/examples/list_splice.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/misc/examples/list_splice.c b/misc/examples/list_splice.c index 8a5dae76..f2f4946f 100644 --- a/misc/examples/list_splice.c +++ b/misc/examples/list_splice.c @@ -8,7 +8,7 @@ void print_ilist(const char* s, clist_i list) { printf("%s", s); - c_FOREACH (i, clist_i, list) { + c_foreach (i, clist_i, list) { printf(" %d", *i.ref); } puts(""); @@ -16,13 +16,10 @@ void print_ilist(const char* s, clist_i list) int main () { - c_AUTO (clist_i, list1, list2) + c_auto (clist_i, list1, list2) { - c_FORLIST (i, int, {1, 2, 3, 4, 5}) - clist_i_push_back(&list1, *i.ref); - - c_FORLIST (i, int, {10, 20, 30, 40, 50}) - clist_i_push_back(&list2, *i.ref); + list1 = c_make(clist_i, {1, 2, 3, 4, 5}); + list2 = c_make(clist_i, {10, 20, 30, 40, 50}); print_ilist("list1:", list1); print_ilist("list2:", list2); |
