cansniffer: simplify, avoiding else case indention

refactoring

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
pull/316/head
Lothar Rubusch 2021-10-16 22:17:28 +02:00
parent d9368a6003
commit 93a6cd6dfb
1 changed files with 5 additions and 6 deletions

View File

@ -580,16 +580,15 @@ int handle_frame(int fd, long currcms)
pos = sniftab_index(cf.can_id);
if (pos < 0) {
/* CAN ID not existing */
if (idx < MAX_SLOTS) {
/* assign new slot */
pos = idx++;
rx_changed = true;
run_qsort = true;
} else {
if (idx >= MAX_SLOTS) {
/* informative exit */
perror("number of different CAN IDs exceeded MAX_SLOTS");
return 0; /* quit */
}
/* assign new slot */
pos = idx++;
rx_changed = true;
run_qsort = true;
}
else {
if (cf.can_dlc == sniftab[pos].current.can_dlc)