mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-07-04 03:33:36 +00:00
Refactoring. Improve code reuse ratio.
Add ARRAY_SIZE() macro. Use the new macro in all places where array size is calculated by means of sizeof(array)/sizeof(array[0]). Fix minor bugs and warnings in the affected code. Signed-off-by: Alexander Amelkin <alexander@amelkin.msk.ru>
This commit is contained in:
@ -241,12 +241,12 @@ serial_bm_open(struct ipmi_intf * intf)
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(rates) / sizeof(rates[0]); i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(rates); i++) {
|
||||
if (rates[i].baudrate == rate) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i >= sizeof(rates) / sizeof(rates[0])) {
|
||||
if (i >= ARRAY_SIZE(rates)) {
|
||||
lprintf(LOG_ERR, "Unsupported baud rate %i specified", rate);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user