diff options
| author | Tyge Løvset <[email protected]> | 2023-03-01 14:54:36 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-03-01 14:54:36 +0100 |
| commit | a203314647b5c37c7e40230551457f006ff36cd5 (patch) | |
| tree | 3d8b9b29595577bee0926434820d602a29487ea3 /include/stc | |
| parent | 78a7e85535fd02e643bf98103223d4218e80133f (diff) | |
| download | STC-modified-a203314647b5c37c7e40230551457f006ff36cd5.tar.gz STC-modified-a203314647b5c37c7e40230551457f006ff36cd5.zip | |
Reverted example moves.
Diffstat (limited to 'include/stc')
| -rw-r--r-- | include/stc/algo/coroutine.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/stc/algo/coroutine.h b/include/stc/algo/coroutine.h index 84be4a4e..6d502988 100644 --- a/include/stc/algo/coroutine.h +++ b/include/stc/algo/coroutine.h @@ -50,7 +50,7 @@ int main(void) { { printf("%d %d\n", it.x, it.y); // example of early stop: - if (++n == 20) (void)cco_stop(&it); // signal to stop at next + if (++n == 20) cco_stop(&it); // signal to stop at next } return 0; } @@ -98,6 +98,9 @@ enum { goto _cco_final_ #define cco_stop(ctx) \ - (cco_alive(ctx) ? ((ctx)->cco_state = cco_state_final) : 0, ctx) + do { \ + int* _state = &(ctx)->cco_state; \ + if (*_state > 0) *_state = cco_state_final; \ + } while (0) #endif |
