]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
tools: kwboot: Use a function to check whether received byte is a Xmodem reply
authorMarek Behún <marek.behun@nic.cz>
Fri, 24 Sep 2021 21:06:49 +0000 (23:06 +0200)
committerStefan Roese <sr@denx.de>
Fri, 1 Oct 2021 09:07:13 +0000 (11:07 +0200)
This is a non-functional change that should make the code more readable.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c

index 7f231c0823c4038d653a0f7d5f22b3d8d86336f8..2e5684b91c98395442d20d5737b179b7093cbc78 100644 (file)
@@ -375,6 +375,12 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
        return n;
 }
 
+static int
+_is_xm_reply(char c)
+{
+       return c == ACK || c == NAK || c == CAN;
+}
+
 static int
 kwboot_xm_sendblock(int fd, struct kwboot_block *block)
 {
@@ -395,10 +401,10 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
                                c = NAK;
                        }
 
-                       if (c != ACK && c != NAK && c != CAN)
+                       if (!_is_xm_reply(c))
                                printf("%c", c);
 
-               } while (c != ACK && c != NAK && c != CAN);
+               } while (!_is_xm_reply(c));
 
                if (c != ACK)
                        kwboot_progress(-1, '+');