Skip to content

Commit

Permalink
drivers/usbhid-ups.c: upsdrv_initups(): cache testvar() outcome as ex…
Browse files Browse the repository at this point in the history
…actly 0/1 [networkupstools#2347]

When building a complex text expression, we rely on maths in some spots.

Signed-off-by: Jim Klimov <[email protected]>
  • Loading branch information
jimklimov committed Aug 12, 2024
1 parent 61574c2 commit 120cd2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/usbhid-ups.c
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,9 @@ void upsdrv_initups(void)
&& (strstr(hd->Product, " BX") || strstr(hd->Product, "BX") == hd->Product)
&& (hd->Product[productLen - 2] == 'M' && hd->Product[productLen - 1] == 'I')
) {
int got_lbrb_log_delay_without_calibrating = testvar("lbrb_log_delay_without_calibrating"),
got_onlinedischarge_calibration = testvar("onlinedischarge_calibration"),
got_onlinedischarge_log_throttle_sec = testvar("onlinedischarge_log_throttle_sec");
int got_lbrb_log_delay_without_calibrating = testvar("lbrb_log_delay_without_calibrating") ? 1 : 0,
got_onlinedischarge_calibration = testvar("onlinedischarge_calibration") ? 1 : 0,
got_onlinedischarge_log_throttle_sec = testvar("onlinedischarge_log_throttle_sec") ? 1 : 0;

lbrb_log_delay_sec = 3;

Expand Down

0 comments on commit 120cd2a

Please sign in to comment.