mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-06 06:49:53 +02:00
cansniffer: simplify, avoiding else case indention
refactoring Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
This commit is contained in:
+5
-6
@@ -580,16 +580,15 @@ int handle_frame(int fd, long currcms)
|
|||||||
pos = sniftab_index(cf.can_id);
|
pos = sniftab_index(cf.can_id);
|
||||||
if (pos < 0) {
|
if (pos < 0) {
|
||||||
/* CAN ID not existing */
|
/* CAN ID not existing */
|
||||||
if (idx < MAX_SLOTS) {
|
if (idx >= MAX_SLOTS) {
|
||||||
/* assign new slot */
|
|
||||||
pos = idx++;
|
|
||||||
rx_changed = true;
|
|
||||||
run_qsort = true;
|
|
||||||
} else {
|
|
||||||
/* informative exit */
|
/* informative exit */
|
||||||
perror("number of different CAN IDs exceeded MAX_SLOTS");
|
perror("number of different CAN IDs exceeded MAX_SLOTS");
|
||||||
return 0; /* quit */
|
return 0; /* quit */
|
||||||
}
|
}
|
||||||
|
/* assign new slot */
|
||||||
|
pos = idx++;
|
||||||
|
rx_changed = true;
|
||||||
|
run_qsort = true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (cf.can_dlc == sniftab[pos].current.can_dlc)
|
if (cf.can_dlc == sniftab[pos].current.can_dlc)
|
||||||
|
|||||||
Reference in New Issue
Block a user