summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/read.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/read.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/read.c')
-rw-r--r--misc/examples/read.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/examples/read.c b/misc/examples/read.c
index ee5dd377..4efdcfeb 100644
--- a/misc/examples/read.c
+++ b/misc/examples/read.c
@@ -6,8 +6,8 @@
cvec_str read_file(const char* name)
{
cvec_str vec = cvec_str_init();
- c_WITH (FILE* f = fopen(name, "r"), fclose(f))
- c_WITH (cstr line = cstr_NULL, cstr_drop(&line))
+ c_with (FILE* f = fopen(name, "r"), fclose(f))
+ c_with (cstr line = cstr_NULL, cstr_drop(&line))
while (cstr_getline(&line, f))
cvec_str_push(&vec, cstr_clone(line));
return vec;
@@ -16,8 +16,8 @@ cvec_str read_file(const char* name)
int main()
{
int n = 0;
- c_WITH (cvec_str vec = read_file(__FILE__), cvec_str_drop(&vec))
- c_FOREACH (i, cvec_str, vec)
+ c_with (cvec_str vec = read_file(__FILE__), cvec_str_drop(&vec))
+ c_foreach (i, cvec_str, vec)
printf("%5d: %s\n", ++n, cstr_str(i.ref));
if (errno)