This is an automated email from the ASF dual-hosted git repository. astitcher pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton.git
commit 57836e6773fed271724e6db1757550adfc7b066a Author: Andrew Stitcher <astitc...@apache.org> AuthorDate: Tue Jun 22 15:50:13 2021 -0400 PROTON-2425: [C] Tweak pn_buffer code to use memcpy It's guaranteed that the memory in these operations can't overlap so use memcpy not memmove. --- c/src/core/buffer.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/c/src/core/buffer.c b/c/src/core/buffer.c index f571e26..07491e7 100644 --- a/c/src/core/buffer.c +++ b/c/src/core/buffer.c @@ -176,8 +176,8 @@ int pn_buffer_append(pn_buffer_t *buf, const char *bytes, size_t size) size_t tail_space = pni_buffer_tail_space(buf); size_t n = pn_min(tail_space, size); - memmove(buf->bytes + tail, bytes, n); - memmove(buf->bytes, bytes + n, size - n); + memcpy(buf->bytes + tail, bytes, n); + memcpy(buf->bytes, bytes + n, size - n); buf->size += size; @@ -193,8 +193,8 @@ int pn_buffer_prepend(pn_buffer_t *buf, const char *bytes, size_t size) size_t head_space = pni_buffer_head_space(buf); size_t n = pn_min(head_space, size); - memmove(buf->bytes + head - n, bytes + size - n, n); - memmove(buf->bytes + buf->capacity - (size - n), bytes, size - n); + memcpy(buf->bytes + head - n, bytes + size - n, n); + memcpy(buf->bytes + buf->capacity - (size - n), bytes, size - n); if (buf->start >= size) { buf->start -= size; @@ -233,8 +233,8 @@ size_t pn_buffer_get(pn_buffer_t *buf, size_t offset, size_t size, char *dst) sz2 = 0; } - memmove(dst, buf->bytes + start, sz1); - memmove(dst + sz1, buf->bytes, sz2); + memcpy(dst, buf->bytes + start, sz1); + memcpy(dst + sz1, buf->bytes, sz2); return sz1 + sz2; } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org