From 93a6cd6dfbd8ba4c6734d5eb2ddc5cd91e78064a Mon Sep 17 00:00:00 2001 From: Lothar Rubusch Date: Sat, 16 Oct 2021 22:17:28 +0200 Subject: [PATCH] cansniffer: simplify, avoiding else case indention refactoring Signed-off-by: Lothar Rubusch --- cansniffer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cansniffer.c b/cansniffer.c index 83348e2..ede0398 100644 --- a/cansniffer.c +++ b/cansniffer.c @@ -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)