MINOR: buffers: Swap buffers of same size only

In b_xfer(), we now take care to swap buffers of the same size only. For
now, it is always the case. But that will change.
This commit is contained in:
Christopher Faulet 2026-01-28 15:02:20 +01:00
parent 6bf450b7fe
commit fae478dae5

View file

@ -348,7 +348,7 @@ size_t b_xfer(struct buffer *dst, struct buffer *src, size_t count)
if (ret > count)
ret = count;
else if (!b_data(dst)) {
else if (!b_data(dst) && b_size(dst) == b_size(src)) {
/* zero copy is possible by just swapping buffers */
struct buffer tmp = *dst;
*dst = *src;