Refactoring: optimize pointer checks

Remove all direct comparisons to 'NULL' for pointers.
Replace them with boolean-like 'if (ptr)' and 'if (!ptr)'.
This makes conditions shorter and easier to read.

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
Alexander Amelkin
2018-08-21 17:16:19 +03:00
parent f3ef88724f
commit e9716e216d
48 changed files with 1050 additions and 1090 deletions

View File

@@ -1632,7 +1632,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
req.msg.data_len = 1;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
if (!rsp) {
printf(" Device not present (No Response)\n");
return -1;
}
@@ -1656,7 +1656,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
spd_data = malloc(fru.size);
if (spd_data == NULL) {
if (!spd_data) {
printf(" Unable to malloc memory for spd array of size=%d\n",
fru.size);
return -1;
@@ -1677,7 +1677,7 @@ ipmi_spd_print_fru(struct ipmi_intf * intf, uint8_t id)
msg_data[3] = FRU_DATA_RQST_SIZE;
rsp = intf->sendrecv(intf, &req);
if (rsp == NULL) {
if (!rsp) {
printf(" Device not present (No Response)\n");
free(spd_data);
spd_data = NULL;