Skip to content
This repository was archived by the owner on Jan 11, 2026. It is now read-only.

Commit 485d7e9

Browse files
committed
remove useless union in struct workio_cmd
1 parent 613ccb3 commit 485d7e9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

ccminer.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ void cuda_reset_device(int thr_id, bool *init);
7878
nvml_handle *hnvml = NULL;
7979
#endif
8080

81-
enum workio_commands {
81+
enum workio_commands
82+
{
8283
WC_GET_WORK,
8384
WC_SUBMIT_WORK,
8485
};
8586

86-
struct workio_cmd {
87-
enum workio_commands cmd;
88-
struct thr_info *thr;
89-
union {
90-
struct work *work;
91-
} u;
87+
struct workio_cmd
88+
{
89+
struct thr_info *thr;
90+
struct work *work;
91+
enum workio_commands cmd;
9292
};
9393

9494
bool opt_debug_diff = false;
@@ -1036,7 +1036,7 @@ static void workio_cmd_free(struct workio_cmd *wc)
10361036
switch(wc->cmd)
10371037
{
10381038
case WC_SUBMIT_WORK:
1039-
free(wc->u.work);
1039+
free(wc->work);
10401040
break;
10411041
default: /* do nothing */
10421042
break;
@@ -1083,7 +1083,7 @@ static bool workio_submit_work(struct workio_cmd *wc, CURL *curl)
10831083
int failures = 0;
10841084

10851085
/* submit solution to bitcoin via JSON-RPC */
1086-
while(!submit_upstream_work(curl, wc->u.work))
1086+
while(!submit_upstream_work(curl, wc->work))
10871087
{
10881088
if(unlikely((opt_retries >= 0) && (++failures > opt_retries)))
10891089
{
@@ -1222,16 +1222,16 @@ static bool submit_work(struct thr_info *thr, const struct work *work_in)
12221222
proper_exit(EXIT_FAILURE);
12231223
}
12241224

1225-
wc->u.work = (struct work *)calloc(1, sizeof(*work_in));
1226-
if(wc->u.work == NULL)
1225+
wc->work = (struct work *)calloc(1, sizeof(*work_in));
1226+
if(wc->work == NULL)
12271227
{
12281228
applog(LOG_ERR, "Out of memory!");
12291229
proper_exit(EXIT_FAILURE);
12301230
}
12311231

12321232
wc->cmd = WC_SUBMIT_WORK;
12331233
wc->thr = thr;
1234-
memcpy(wc->u.work, work_in, sizeof(*work_in));
1234+
memcpy(wc->work, work_in, sizeof(*work_in));
12351235

12361236
/* send solution to workio thread */
12371237
if(!tq_push(thr_info[work_thr_id].q, wc))

0 commit comments

Comments
 (0)