Skip to content

Commit bcbbec5

Browse files
style: address review comments
1 parent 681cd38 commit bcbbec5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

applications/main/infrared/infrared_cli.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,28 +177,28 @@ static bool infrared_cli_parse_raw(const char* str, InfraredSignal* signal) {
177177
return false;
178178
}
179179

180-
uint32_t* timings = malloc(sizeof(uint32_t) * MAX_TIMINGS_AMOUNT);
181180
uint32_t frequency;
182181
uint32_t duty_cycle_u32;
183182
if(strint_to_uint32(frequency_str, NULL, &frequency, 10) != StrintParseNoError ||
184-
strint_to_uint32(duty_cycle_str, NULL, &duty_cycle_u32, 10) != StrintParseNoError) {
185-
free(timings);
183+
strint_to_uint32(duty_cycle_str, NULL, &duty_cycle_u32, 10) != StrintParseNoError)
186184
return false;
187-
}
188185
float duty_cycle = duty_cycle_u32 / 100.0f;
189186

190187
str += strlen(frequency_str) + strlen(duty_cycle_str) + INFRARED_CLI_BUF_SIZE;
191188

189+
uint32_t* timings = malloc(sizeof(uint32_t) * MAX_TIMINGS_AMOUNT);
192190
size_t timings_size = 0;
193191
while(1) {
194192
while(*str == ' ') {
195193
++str;
196194
}
197195

198196
uint32_t timing;
199-
if(strint_to_uint32(str, (char**)&str, &timing, 10) != StrintParseNoError) {
197+
char* next_token;
198+
if(strint_to_uint32(str, &next_token, &timing, 10) != StrintParseNoError) {
200199
break;
201200
}
201+
str = next_token;
202202

203203
if((timing <= 0) || (timings_size >= MAX_TIMINGS_AMOUNT)) {
204204
break;

0 commit comments

Comments
 (0)