From: Gerhard Sittig Date: Wed, 21 Feb 2018 17:03:11 +0000 (+0100) Subject: uni-t-dmm: style nits, copy loop vs memmove X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f7711ed56c905bb8562b6076bb70904950a9213c;p=libsigrok.git uni-t-dmm: style nits, copy loop vs memmove --- diff --git a/src/hardware/uni-t-dmm/protocol.c b/src/hardware/uni-t-dmm/protocol.c index 11177083..94abb16b 100644 --- a/src/hardware/uni-t-dmm/protocol.c +++ b/src/hardware/uni-t-dmm/protocol.c @@ -258,8 +258,8 @@ static int get_and_handle_data(struct sr_dev_inst *sdi) } /* Move remaining bytes to beginning of buffer. */ - for (i = 0; i < devc->buflen - devc->bufoffset; i++) - pbuf[i] = pbuf[devc->bufoffset + i]; + if (devc->bufoffset < devc->buflen) + memmove(pbuf, pbuf + devc->bufoffset, devc->buflen - devc->bufoffset); devc->buflen -= devc->bufoffset; return SR_OK;