mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-08-07 15:47:01 +02:00
MINOR: buffers: split b_force_xfer() into b_cpy() and b_force_xfer()
Split the b_force_xfer() into b_ncat() and b_force_xfer(). The previous b_force_xfer() implementation was basically a copy with a b_del on the src buffer. Keep this implementation to make b_ncat(), and just call b_ncat() + b_del() into b_force_xfer().
This commit is contained in:
parent
9e4ead3095
commit
35df34223b
@ -614,11 +614,12 @@ static inline size_t b_xfer(struct buffer *dst, struct buffer *src, size_t count
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* b_force_xfer() : same as b_xfer() but without zero copy.
|
/* b_ncat() : Copy <count> from <src> buffer at the end of <dst> buffer.
|
||||||
* The caller is responsible for ensuring that <count> is not
|
* The caller is responsible for ensuring that <count> is not larger than
|
||||||
* larger than b_room(dst).
|
* b_room(dst).
|
||||||
|
* Returns the number of bytes copied.
|
||||||
*/
|
*/
|
||||||
static inline size_t b_force_xfer(struct buffer *dst, struct buffer *src, size_t count)
|
static inline size_t b_ncat(struct buffer *dst, struct buffer *src, size_t count)
|
||||||
{
|
{
|
||||||
size_t ret, block1, block2;
|
size_t ret, block1, block2;
|
||||||
|
|
||||||
@ -643,10 +644,25 @@ static inline size_t b_force_xfer(struct buffer *dst, struct buffer *src, size_t
|
|||||||
if (block2)
|
if (block2)
|
||||||
__b_putblk(dst, b_peek(src, block1), block2);
|
__b_putblk(dst, b_peek(src, block1), block2);
|
||||||
|
|
||||||
b_del(src, ret);
|
|
||||||
leave:
|
leave:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* b_force_xfer() : same as b_xfer() but without zero copy.
|
||||||
|
* The caller is responsible for ensuring that <count> is not
|
||||||
|
* larger than b_room(dst).
|
||||||
|
*/
|
||||||
|
static inline size_t b_force_xfer(struct buffer *dst, struct buffer *src, size_t count)
|
||||||
|
{
|
||||||
|
size_t ret;
|
||||||
|
|
||||||
|
ret = b_ncat(dst, src, count);
|
||||||
|
b_del(src, ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Moves <len> bytes from absolute position <src> of buffer <b> by <shift>
|
/* Moves <len> bytes from absolute position <src> of buffer <b> by <shift>
|
||||||
* bytes, while supporting wrapping of both the source and the destination.
|
* bytes, while supporting wrapping of both the source and the destination.
|
||||||
* The position is relative to the buffer's origin and may overlap with the
|
* The position is relative to the buffer's origin and may overlap with the
|
||||||
|
Loading…
Reference in New Issue
Block a user