]> sigrok.org Git - libsigrok.git/commitdiff
saleae-logic-pro: style nits, copy loop vs memcpy
authorGerhard Sittig <redacted>
Wed, 21 Feb 2018 17:01:41 +0000 (18:01 +0100)
committerUwe Hermann <redacted>
Sat, 3 Mar 2018 17:58:59 +0000 (18:58 +0100)
src/hardware/saleae-logic-pro/protocol.c

index 2613b271243ff2f7caa8a7d7f7d9b845974b9535..351032af39ff043f1b0ed764b9f8915fb3b39531 100644 (file)
@@ -186,7 +186,6 @@ static int read_regs(const struct sr_dev_inst *sdi,
                     uint8_t cnt)
 {
        uint8_t req[33];
-       int i;
 
        if (cnt < 1 || cnt > 30)
                return SR_ERR_ARG;
@@ -194,10 +193,8 @@ static int read_regs(const struct sr_dev_inst *sdi,
        req[0] = 0x00;
        req[1] = COMMAND_READ_REG;
        req[2] = cnt;
-
-       for (i = 0; i < cnt; i++) {
-               req[3 + i] = regs[i];
-       }
+       if (cnt)
+               memcpy(&req[3], regs, cnt);
 
        return transact(sdi, req, 3 + cnt, values, cnt);
 }