summaryrefslogtreecommitdiffhomepage
path: root/misc/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-05-24 14:38:54 +0200
committerGitHub <[email protected]>2023-05-24 14:38:54 +0200
commit8a19b4d6ff098ec014244c86569a7bea2db65514 (patch)
tree9d9e2c6878f56552e35de9273c76766cfe229fb4 /misc/examples
parent00150a367c1e50c6b68ab878043beb6c1c8baa02 (diff)
parent6973d104999f47e0baad4b23d36642f86775be90 (diff)
downloadSTC-modified-8a19b4d6ff098ec014244c86569a7bea2db65514.tar.gz
STC-modified-8a19b4d6ff098ec014244c86569a7bea2db65514.zip
Merge pull request #57 from liigo/dev43
add `cco` macro, block style coroutine definition
Diffstat (limited to 'misc/examples')
-rw-r--r--misc/examples/coread.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/examples/coread.c b/misc/examples/coread.c
index e60fb31c..1976231f 100644
--- a/misc/examples/coread.c
+++ b/misc/examples/coread.c
@@ -13,7 +13,7 @@ struct file_read {
void file_read(struct file_read* g)
{
- cco_begin(g)
+ cco(g) {
g->fp = fopen(g->filename, "r");
g->line = cstr_init();
@@ -23,7 +23,8 @@ void file_read(struct file_read* g)
printf("finish\n");
cstr_drop(&g->line);
fclose(g->fp);
- cco_end();
+ }
+ return;
}
int main(void)