Skip to content

Commit de24e9b

Browse files
committed
uart: more readable loop
1 parent c02762d commit de24e9b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cores/esp8266/uart.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,10 +234,11 @@ size_t uart_write(uart_t* uart, const char* buf, size_t size)
234234
if(uart == NULL || !uart->tx_enabled) {
235235
return 0;
236236
}
237-
for (size_t s = size + 1; --s; ) {
237+
size_t ret = size;
238+
while (size--) {
238239
uart_do_write_char(uart, *buf++);
239240
}
240-
return size;
241+
return ret;
241242
}
242243

243244
size_t uart_tx_free(uart_t* uart)

0 commit comments

Comments
 (0)