]> git.ozlabs.org Git - ccan/blobdiff - ccan/coroutine/test/api-3.c
coroutine: Move total initialization outside coroutine
[ccan] / ccan / coroutine / test / api-3.c
index e06c03d3c47f2eec23e4dd9c0bee666ecd1ee0f6..129126549e3edb6ceefd39bb8d2e281dad80587e 100644 (file)
@@ -27,9 +27,6 @@ static void clobber(void *p)
                buf[i] = random() & 0xff;
        }
 
-       diag("Wrote random to buffer\n");
-
-       s->total = 0;
        for (i = 0; i < sizeof(buf); i++) {
                s->total += buf[i];
        }
@@ -50,6 +47,7 @@ static void test_metadata(struct coroutine_stack *stack)
        if (COROUTINE_AVAILABLE) {
                struct coroutine_state t;
                struct state s = {
+                       .total = 0,
                };
 
                coroutine_init(&t, clobber, &s, stack);