mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-22 04:10:48 +00:00
MINOR: htx: don't rely on htx_find_blk() anymore in the function htx_truncate()
the function htx_find_blk() is used by only one function, htx_truncate(). So because this function does nothing very smart, we don't use it anymore. It will be removed by another commit.
This commit is contained in:
parent
0f6d6a9ab6
commit
ced39006a2
17
src/htx.c
17
src/htx.c
@ -284,15 +284,20 @@ struct htx_blk *htx_remove_blk(struct htx *htx, struct htx_blk *blk)
|
||||
void htx_truncate(struct htx *htx, uint32_t offset)
|
||||
{
|
||||
struct htx_blk *blk;
|
||||
struct htx_ret htxret;
|
||||
|
||||
htxret = htx_find_blk(htx, offset);
|
||||
blk = htxret.blk;
|
||||
if (blk && htxret.ret) {
|
||||
for (blk = htx_get_head_blk(htx); blk && offset; blk = htx_get_next_blk(htx, blk)) {
|
||||
uint32_t sz = htx_get_blksz(blk);
|
||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
||||
|
||||
htx_set_blk_value_len(blk, sz - htxret.ret);
|
||||
blk = htx_get_next_blk(htx, blk);
|
||||
if (offset >= sz) {
|
||||
offset -= sz;
|
||||
continue;
|
||||
}
|
||||
if (type == HTX_BLK_DATA || type == HTX_BLK_TLR) {
|
||||
htx_set_blk_value_len(blk, offset);
|
||||
htx->data -= (sz - offset);
|
||||
}
|
||||
offset = 0;
|
||||
}
|
||||
while (blk)
|
||||
blk = htx_remove_blk(htx, blk);
|
||||
|
Loading…
Reference in New Issue
Block a user