Provide a blank get_statline_before function for drivers that don't have one.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
diff --git a/cgminer.c b/cgminer.c
index 17e3df8..a325a64 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1900,10 +1900,7 @@ static void get_statline(char *buf, struct cgpu_info *cgpu)
suffix_string(dr64, displayed_rolling, 4);
sprintf(buf, "%s%d ", cgpu->drv->name, cgpu->device_id);
- if (cgpu->drv->get_statline_before)
- cgpu->drv->get_statline_before(buf, cgpu);
- else
- tailsprintf(buf, " | ");
+ cgpu->drv->get_statline_before(buf, cgpu);
tailsprintf(buf, "(%ds):%s (avg):%sh/s | A:%d R:%d HW:%d U:%.1f/m",
opt_log_interval,
displayed_rolling,
@@ -1999,13 +1996,9 @@ static void curses_print_devstatus(int thr_id)
wmove(statuswin,devcursor + cgpu->cgminer_id, 0);
wprintw(statuswin, " %s %*d: ", cgpu->drv->name, dev_width, cgpu->device_id);
- if (cgpu->drv->get_statline_before) {
- logline[0] = '\0';
- cgpu->drv->get_statline_before(logline, cgpu);
- wprintw(statuswin, "%s", logline);
- }
- else
- wprintw(statuswin, " | ");
+ logline[0] = '\0';
+ cgpu->drv->get_statline_before(logline, cgpu);
+ wprintw(statuswin, "%s", logline);
dh64 = (double)cgpu->total_mhashes / total_secs * 1000000ull;
dr64 = (double)cgpu->rolling * 1000000ull;
@@ -6381,6 +6374,11 @@ void noop_reinit_device(struct cgpu_info __maybe_unused *cgpu)
{
}
+void blank_get_statline_before(char *buf, struct cgpu_info __maybe_unused *cgpu)
+{
+ tailsprintf(buf, " | ");
+}
+
/* Fill missing driver api functions with noops */
void fill_device_api(struct cgpu_info *cgpu)
{
@@ -6388,6 +6386,8 @@ void fill_device_api(struct cgpu_info *cgpu)
if (!drv->reinit_device)
drv->reinit_device = &noop_reinit_device;
+ if (!drv->get_statline_before)
+ drv->get_statline_before = &blank_get_statline_before;
}
void enable_device(struct cgpu_info *cgpu)
@@ -6403,6 +6403,7 @@ void enable_device(struct cgpu_info *cgpu)
gpu_threads += cgpu->threads;
}
#endif
+ fill_device_api(cgpu);
}
struct _cgpu_devid_counter {