summaryrefslogtreecommitdiffhomepage
path: root/examples/read.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2022-08-13 19:02:50 +0200
committerTyge Løvset <[email protected]>2022-08-13 19:02:50 +0200
commit9bdcf2090da121f8d0954dad35db48c7aa47b17e (patch)
treeb2d10dc4d069059434174e9cdee5251cae8ff10c /examples/read.c
parentccb63f1abbae18657708dd8ea38e0892aa0fc48a (diff)
downloadSTC-modified-9bdcf2090da121f8d0954dad35db48c7aa47b17e.tar.gz
STC-modified-9bdcf2090da121f8d0954dad35db48c7aa47b17e.zip
Experimental: Renamed c_autovar => c_with, c_autoscope => c_scope, c_autodefer => c_defer. May or may not be reverted before V4.0 release.
Diffstat (limited to 'examples/read.c')
-rw-r--r--examples/read.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/examples/read.c b/examples/read.c
index 26fc46dd..5a9a30d5 100644
--- a/examples/read.c
+++ b/examples/read.c
@@ -6,8 +6,8 @@
cvec_str read_file(const char* name)
{
cvec_str vec = cvec_str_init();
- c_autovar (FILE* f = fopen(name, "r"), fclose(f))
- c_autovar (cstr line = cstr_init(), 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,7 +16,7 @@ cvec_str read_file(const char* name)
int main()
{
int n = 0;
- c_autovar (cvec_str vec = read_file(__FILE__), cvec_str_drop(&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));