From b9612715aa757759f1da28717574a93bd343a2d9 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 6 Feb 2012 10:40:04 +1100 Subject: [PATCH] Replace divide_work with reuse_work function used twice. --- cgminer.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cgminer.c b/cgminer.c index 2b7a20ee..9d39fd38 100644 --- a/cgminer.c +++ b/cgminer.c @@ -2980,7 +2980,7 @@ static void roll_work(struct work *work) work->id = total_work++; } -static bool divide_work(struct work *work) +static bool reuse_work(struct work *work) { if (can_roll(work) && should_roll(work)) { roll_work(work); @@ -3012,8 +3012,7 @@ retry: newreq = true; } - if (can_roll(work) && should_roll(work)) { - roll_work(work); + if (reuse_work(work)) { ret = true; goto out; } @@ -3056,10 +3055,8 @@ retry: memcpy(work, work_heap, sizeof(*work)); - /* Copy the res nonce back so we know to start at a higher baseline - * should we divide the same work up again. Make the work we're - * handing out be clone */ - if (divide_work(work_heap)) { + /* Hand out a clone if we can roll this work item */ + if (reuse_work(work_heap)) { if (opt_debug) applog(LOG_DEBUG, "Pushing divided work to get queue head");