astitcher commented on code in PR #435:
URL: https://github.com/apache/qpid-proton/pull/435#discussion_r1821300422


##########
c/src/core/buffer.c:
##########
@@ -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);

Review Comment:
   I think this logic is actually part of the _rotate function and should be 
there.
   
   Also our code formatting has the braces explicitly present for this format 
of ```if```:
   ```
   if (...) {
     ...
   } else {
     ...
   }'''



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to