From 73671ab360cab04823dac13ced316cc657c028d3 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 24 Nov 2012 18:45:02 +1100 Subject: [PATCH] Remove all static work structs, using the make and free functions. --- cgminer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cgminer.c b/cgminer.c index fc2090d3..04da7790 100644 --- a/cgminer.c +++ b/cgminer.c @@ -4737,14 +4737,13 @@ static void *stratum_thread(void *userdata) applog(LOG_INFO, "Unknown stratum msg: %s", s); free(s); if (pool->swork.clean) { - struct work work; - memset(&work, 0, sizeof(work)); + struct work *work = make_work(); /* Generate a single work item to update the current * block database */ pool->swork.clean = false; - gen_stratum_work(pool, &work); - if (test_work_current(&work)) { + gen_stratum_work(pool, work); + if (test_work_current(work)) { /* Only accept a work restart if this stratum * connection is from the current pool */ if (pool == current_pool()) { @@ -4753,8 +4752,8 @@ static void *stratum_thread(void *userdata) } } else applog(LOG_NOTICE, "Stratum from pool %d detected new block", pool->pool_no); + free_work(work); } - } out: @@ -5936,8 +5935,8 @@ static bool pool_getswork(struct pool *pool) gettimeofday(&tv_getwork_reply, NULL); if (val) { - struct work work; - bool rc = work_decode(pool, &work, val); + struct work *work = make_work(); + bool rc = work_decode(pool, work, val); if (rc) { applog(LOG_DEBUG, "Successfully retrieved and deciphered work from pool %u %s", @@ -5949,6 +5948,7 @@ static bool pool_getswork(struct pool *pool) pool->pool_no, pool->rpc_url); } json_decref(val); + free_work(work); } else { applog(LOG_DEBUG, "FAILED to retrieve pool_getswork work from pool %u %s", pool->pool_no, pool->rpc_url);