summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/new_list.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/new_list.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/new_list.c')
-rw-r--r--misc/examples/new_list.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/misc/examples/new_list.c b/misc/examples/new_list.c
index c5d90ad1..6dbe80b4 100644
--- a/misc/examples/new_list.c
+++ b/misc/examples/new_list.c
@@ -35,27 +35,27 @@ int point_cmp(const Point* a, const Point* b) {
int main()
{
- c_AUTO (clist_i32, lst)
+ c_auto (clist_i32, lst)
clist_i32_push_back(&lst, 123);
- c_AUTO (clist_pnt, plst) {
- c_FORLIST (i, Point, {{42, 14}, {32, 94}, {62, 81}})
+ c_auto (clist_pnt, plst) {
+ c_forlist (i, Point, {{42, 14}, {32, 94}, {62, 81}})
clist_pnt_push_back(&plst, *i.ref);
clist_pnt_sort(&plst);
- c_FOREACH (i, clist_pnt, plst)
+ c_foreach (i, clist_pnt, plst)
printf(" (%d %d)", i.ref->x, i.ref->y);
puts("");
}
- c_AUTO (clist_float, flst) {
- c_FORLIST (i, float, {123.3f, 321.2f, -32.2f, 78.2f})
+ c_auto (clist_float, flst) {
+ c_forlist (i, float, {123.3f, 321.2f, -32.2f, 78.2f})
clist_float_push_back(&flst, *i.ref);
- c_FOREACH (i, clist_float, flst) printf(" %g", *i.ref);
+ c_foreach (i, clist_float, flst) printf(" %g", *i.ref);
}
- c_AUTO (clist_str, slst)
+ c_auto (clist_str, slst)
clist_str_emplace_back(&slst, "Hello, friend");
}