Skip to content

Commit

Permalink
PROTON-2859: Improve performance of pn_buffer_t defrag
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffjansen committed Oct 23, 2024
1 parent 5c319fe commit 21ce8ca
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion c/src/core/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,10 @@ static void pn_buffer_rotate (pn_buffer_t *buf, size_t sz) {

static inline int pn_buffer_defrag(pn_buffer_t *buf)
{
pn_buffer_rotate(buf, buf->start);
if (pni_buffer_wrapped(buf))
pn_buffer_rotate(buf, buf->start);
else
memmove(buf->bytes, buf->bytes + buf->start, buf->size);
buf->start = 0;
return 0;
}
Expand Down

0 comments on commit 21ce8ca

Please sign in to comment.