mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 14:21:25 +02:00
CLEANUP: htx: Properly indent htx_reserve_max_data() function
Spaces were used instead of tabs to indent htx_reserve_max_data() function. Let's reindent the whole function.
This commit is contained in:
parent
c57af8ebcd
commit
e5fe2013a9
90
src/htx.c
90
src/htx.c
@ -887,59 +887,59 @@ struct htx_sl *htx_replace_stline(struct htx *htx, struct htx_blk *blk, const st
|
||||
*/
|
||||
struct htx_ret htx_reserve_max_data(struct htx *htx)
|
||||
{
|
||||
struct htx_blk *blk, *tailblk;
|
||||
uint32_t sz, room;
|
||||
int32_t len = htx_free_data_space(htx);
|
||||
struct htx_blk *blk, *tailblk;
|
||||
uint32_t sz, room;
|
||||
int32_t len = htx_free_data_space(htx);
|
||||
|
||||
if (htx->head == -1)
|
||||
goto rsv_new_block;
|
||||
if (htx->head == -1)
|
||||
goto rsv_new_block;
|
||||
|
||||
if (!len)
|
||||
return (struct htx_ret){.ret = 0, .blk = NULL};
|
||||
if (!len)
|
||||
return (struct htx_ret){.ret = 0, .blk = NULL};
|
||||
|
||||
/* get the tail and head block */
|
||||
tailblk = htx_get_tail_blk(htx);
|
||||
if (tailblk == NULL)
|
||||
goto rsv_new_block;
|
||||
sz = htx_get_blksz(tailblk);
|
||||
/* get the tail and head block */
|
||||
tailblk = htx_get_tail_blk(htx);
|
||||
if (tailblk == NULL)
|
||||
goto rsv_new_block;
|
||||
sz = htx_get_blksz(tailblk);
|
||||
|
||||
/* Don't try to append data if the last inserted block is not of the
|
||||
* same type */
|
||||
if (htx_get_blk_type(tailblk) != HTX_BLK_DATA)
|
||||
goto rsv_new_block;
|
||||
/* Don't try to append data if the last inserted block is not of the
|
||||
* same type */
|
||||
if (htx_get_blk_type(tailblk) != HTX_BLK_DATA)
|
||||
goto rsv_new_block;
|
||||
|
||||
/*
|
||||
* Same type and enough space: append data
|
||||
*/
|
||||
if (!htx->head_addr) {
|
||||
if (tailblk->addr+sz != htx->tail_addr)
|
||||
goto rsv_new_block;
|
||||
room = (htx_pos_to_addr(htx, htx->tail) - htx->tail_addr);
|
||||
}
|
||||
else {
|
||||
if (tailblk->addr+sz != htx->head_addr)
|
||||
goto rsv_new_block;
|
||||
room = (htx->end_addr - htx->head_addr);
|
||||
}
|
||||
BUG_ON((int32_t)room < 0);
|
||||
if (room < len)
|
||||
len = room;
|
||||
/*
|
||||
* Same type and enough space: append data
|
||||
*/
|
||||
if (!htx->head_addr) {
|
||||
if (tailblk->addr+sz != htx->tail_addr)
|
||||
goto rsv_new_block;
|
||||
room = (htx_pos_to_addr(htx, htx->tail) - htx->tail_addr);
|
||||
}
|
||||
else {
|
||||
if (tailblk->addr+sz != htx->head_addr)
|
||||
goto rsv_new_block;
|
||||
room = (htx->end_addr - htx->head_addr);
|
||||
}
|
||||
BUG_ON((int32_t)room < 0);
|
||||
if (room < len)
|
||||
len = room;
|
||||
|
||||
append_data:
|
||||
htx_change_blk_value_len(htx, tailblk, sz+len);
|
||||
append_data:
|
||||
htx_change_blk_value_len(htx, tailblk, sz+len);
|
||||
|
||||
BUG_ON((int32_t)htx->tail_addr < 0);
|
||||
BUG_ON((int32_t)htx->head_addr < 0);
|
||||
BUG_ON(htx->end_addr > htx->tail_addr);
|
||||
BUG_ON(htx->head_addr > htx->end_addr);
|
||||
return (struct htx_ret){.ret = sz, .blk = tailblk};
|
||||
BUG_ON((int32_t)htx->tail_addr < 0);
|
||||
BUG_ON((int32_t)htx->head_addr < 0);
|
||||
BUG_ON(htx->end_addr > htx->tail_addr);
|
||||
BUG_ON(htx->head_addr > htx->end_addr);
|
||||
return (struct htx_ret){.ret = sz, .blk = tailblk};
|
||||
|
||||
rsv_new_block:
|
||||
blk = htx_add_blk(htx, HTX_BLK_DATA, len);
|
||||
if (!blk)
|
||||
return (struct htx_ret){.ret = 0, .blk = NULL};
|
||||
blk->info += len;
|
||||
return (struct htx_ret){.ret = 0, .blk = blk};
|
||||
rsv_new_block:
|
||||
blk = htx_add_blk(htx, HTX_BLK_DATA, len);
|
||||
if (!blk)
|
||||
return (struct htx_ret){.ret = 0, .blk = NULL};
|
||||
blk->info += len;
|
||||
return (struct htx_ret){.ret = 0, .blk = blk};
|
||||
}
|
||||
|
||||
/* Adds an HTX block of type DATA in <htx>. It first tries to append data if
|
||||
|
Loading…
x
Reference in New Issue
Block a user