8 Commits

Author SHA1 Message Date
Alexander Amelkin
956ae2b372 Finalize refactoring of string comparisons
Unify the comparison idioms use.
Always use `if(!strcmp())` for "if string equals"
and `if(strcmp())` for "if string is not equal".
Never use `== 0` and `!= 0` with `strcmp()`.

Minor reformatting of the code immediately surrounding the
refactored lines.

Resolves ipmitool/ipmitool#104

Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
2020-06-10 13:46:57 +03:00
Jiang Junyu
6e037d6bfb Refactor string comparisons
Clean up use of strcmp/strncmp/strncasecmp for command line arguments.
Never use anything but `strcmp()` unless absolutely neccessary.

Partialy resolves ipmitool/ipmitool#104
2020-06-10 13:46:57 +03:00
Alexander Amelkin
e9716e216d
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>
2018-08-21 17:30:25 +03:00
Alexander Amelkin
9ecfb762bd
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>
2018-08-21 11:55:03 +03:00
Pat Donlin
259500e127 ID: 380 raw commands override retry and timeout values
Remove the hard coded override for retry and timeout in ipmi_master_write_read
2015-07-25 09:43:57 +02:00
Pat Donlin
70099a3c40 ID: 380 - raw commands override retry and timeout values
Correct compiler warnings in ipmi_raw.c
2015-07-25 09:43:51 +02:00
Zdenek Styblik
0ff2d6e464 ID:357 - out-of-bound access in DDR4 code
Commit increases RAW_SPD_SIZE from 256 to 512 as an attempt to fix OOB in
ipmi_rawspd_main(), resp. ipmi_spd_print().
2015-01-16 20:18:41 +01:00
Petter Reinholdtsen
c18ec02f33 Move all files one level up in the file hierarcy, to avoid the useless ipmitool directory. 2014-02-05 17:30:32 +01:00