cloudwu / coroutine

A asymmetric coroutine library for C.
MIT License
2.44k stars 686 forks source link

coroutine_new bug #1

Closed jing3018 closed 12 years ago

jing3018 commented 12 years ago
diff --git a/coroutine.c b/coroutine.c
index 7afdc1c..5470d0d 100644
--- a/coroutine.c
+++ b/coroutine.c
@@ -81,7 +81,7 @@ coroutine_new(struct schedule *S, coroutine_func func, void *ud) {
        struct coroutine *co = _co_new(S, func , ud);
        if (S->nco >= S->cap) {
                int id = S->cap;
-               S->cap *= 2;
+               //S->cap *= 2;
                S->co = realloc(S->co, S->cap * 2 * sizeof(struct coroutine *));
                memset(S->co + S->cap , 0 , sizeof(struct coroutine *) * S->cap);
                S->co[S->cap] = co;
cloudwu commented 12 years ago

fix