summaryrefslogtreecommitdiffhomepage
path: root/misc
diff options
context:
space:
mode:
authorLiigo Zhuang <[email protected]>2023-05-18 14:18:10 +0800
committerLiigo Zhuang <[email protected]>2023-05-18 14:18:10 +0800
commit6973d104999f47e0baad4b23d36642f86775be90 (patch)
tree2292d06d8f61ed872a96e392afc043f156e79ec3 /misc
parentbe7d9913d4a284bdeb7f0431482b5731b5ef31df (diff)
downloadSTC-modified-6973d104999f47e0baad4b23d36642f86775be90.tar.gz
STC-modified-6973d104999f47e0baad4b23d36642f86775be90.zip
add `cco` macro, block style coroutine definition, to replace cco_begin(co) && cco_end()
Diffstat (limited to 'misc')
-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)