From 352f27ef2411307e4daa9f89ba00fd4249d94257 Mon Sep 17 00:00:00 2001 From: Mingjie Shen Date: Tue, 30 May 2023 14:26:20 -0400 Subject: [PATCH] Change iteration variable of the nested for statement When a nested loop uses the same iteration variable as its outer loop, the behavior of the outer loop easily becomes difficult to understand as the inner loop will affect its control flow. It is likely to be a typo. --- library/src/dsm.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/src/dsm.c b/library/src/dsm.c index c8b72b66..cbba0922 100644 --- a/library/src/dsm.c +++ b/library/src/dsm.c @@ -137,7 +137,7 @@ static int __continue_or_quit(void) */ static void* __parser_func(__attribute__ ((unused)) void* ptr){ uint8_t buf[DSM_PACKET_SIZE]; - int i, ret; + int i, j, ret; int new_values[RC_MAX_DSM_CHANNELS]; // hold new values before committing int detection_packets_left; // use first 4 packets just for detection unsigned char ch_id; @@ -396,8 +396,8 @@ static void* __parser_func(__attribute__ ((unused)) void* ptr){ #ifdef DEBUG fprintf(stderr,"missing channel data in packet\n"); #endif - for(i=0;i