mirror of
https://github.com/ipmitool/ipmitool.git
synced 2026-06-28 08:11:36 +00:00
Refactoring: get rid of superfluous comparisons
Make code better readable by replacing `if (rsp->ccode > 0)` and 'if (rsp->ccode != 0)' with just `if (rsp->ccode)` as rsp->ccode is anyway an unsigned byte and can't be negative. Also replace 'if (rsp->ccode == 0)' with 'if (!rsp->ccode)'. All these changes make lines shorter and easier to read as a non-zero ccode is an indication of some failure, and so !ccode naturally reads as 'no error'. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
@@ -603,7 +603,7 @@ ipmi_usb_send_cmd(struct ipmi_intf *intf, struct ipmi_rq *req)
|
||||
rsp.ccode = rsp.data[0];
|
||||
|
||||
/* Save response data for caller */
|
||||
if ((rsp.ccode == 0) && (rsp.data_len > 0)) {
|
||||
if (!rsp.ccode && rsp.data_len > 0) {
|
||||
memmove(rsp.data, rsp.data + 1, rsp.data_len - 1);
|
||||
rsp.data[rsp.data_len] = 0;
|
||||
rsp.data_len -= 1;
|
||||
|
||||
Reference in New Issue
Block a user