summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/list_erase.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-08 16:16:49 +0100
committerTyge Løvset <[email protected]>2023-02-08 17:18:24 +0100
commitc4441f5fc665194fbd7a894a67a64a08c3beac42 (patch)
tree82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/examples/list_erase.c
parent673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff)
downloadSTC-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_erase.c')
-rw-r--r--misc/examples/list_erase.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/misc/examples/list_erase.c b/misc/examples/list_erase.c
index 18ad0d16..47f56625 100644
--- a/misc/examples/list_erase.c
+++ b/misc/examples/list_erase.c
@@ -7,12 +7,9 @@
int main ()
{
- c_WITH (IList L = IList_init(), IList_drop(&L))
+ c_with (IList L = c_make(IList, {10, 20, 30, 40, 50}), IList_drop(&L))
{
- c_FORLIST (i, int, {10, 20, 30, 40, 50})
- IList_push(&L, *i.ref);
-
- c_FOREACH (x, IList, L)
+ c_foreach (x, IList, L)
printf("%d ", *x.ref);
puts("");
// 10 20 30 40 50
@@ -25,7 +22,7 @@ int main ()
it = IList_erase_range(&L, it, end); // 10 30
// ^
printf("list contains:");
- c_FOREACH (x, IList, L)
+ c_foreach (x, IList, L)
printf(" %d", *x.ref);
puts("");
}