From 84428858dd74d951c66cc78def6638c2b614e2a6 Mon Sep 17 00:00:00 2001 From: stefanrueger Date: Sat, 15 Aug 2026 01:44:02 +0200 Subject: [PATCH] Shorten jtag3_paged_write() --- src/jtag3.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/jtag3.c b/src/jtag3.c index 79e95a45..6d264028 100644 --- a/src/jtag3.c +++ b/src/jtag3.c @@ -1957,7 +1957,6 @@ static int jtag3_page_erase(const PROGRAMMER *pgm, const AVRPART *p, const AVRME static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRMEM *m, unsigned int page_size, unsigned int addr, unsigned int n_bytes) { - unsigned int block_size = 0; unsigned int maxaddr = addr + n_bytes; unsigned char *cmd, *resp = NULL; int status, dynamic_mtype = 0; @@ -2013,10 +2012,7 @@ static int jtag3_paged_write(const PROGRAMMER *pgm, const AVRPART *p, const AVRM } serial_recv_timeout = 100; for(; addr < maxaddr; addr += page_size) { - if((maxaddr - addr) < page_size) - block_size = maxaddr - addr; - else - block_size = page_size; + unsigned int block_size = maxaddr - addr < page_size? maxaddr - addr: page_size; pmsg_debug("%s(): block_size at addr %d is %d\n", __func__, addr, block_size); if(dynamic_mtype)