From: Gerhard Sittig Date: Wed, 21 Feb 2018 17:01:41 +0000 (+0100) Subject: saleae-logic-pro: style nits, copy loop vs memcpy X-Git-Url: https://sigrok.org/gitweb/?p=libsigrok.git;a=commitdiff_plain;h=69229e5c155fffa07da772dc4bf790cab76178eb saleae-logic-pro: style nits, copy loop vs memcpy --- diff --git a/src/hardware/saleae-logic-pro/protocol.c b/src/hardware/saleae-logic-pro/protocol.c index 2613b271..351032af 100644 --- a/src/hardware/saleae-logic-pro/protocol.c +++ b/src/hardware/saleae-logic-pro/protocol.c @@ -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); }