MINOR: htx: add an unchecked version of htx_get_head_blk()
htx_get_head_blk() is used at plenty of places, many of which are known to be safe, but the function checks for the presence of a first block and returns NULL if it doesn't exist. While it's properly used, it makes compilers complain at -Os on stream.c and mux_fcgi.c because they probably don't propagate variables far enough to see that there's no risk. Let's add an unchecked version for these use cases.
This commit is contained in:
parent
8e9f915f8f
commit
771483da3e
@ -189,6 +189,16 @@ static inline struct htx_blk *htx_get_head_blk(const struct htx *htx)
|
|||||||
return ((head == -1) ? NULL : htx_get_blk(htx, head));
|
return ((head == -1) ? NULL : htx_get_blk(htx, head));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* same as above but unchecked, may only be used when certain that a block
|
||||||
|
* exists.
|
||||||
|
*/
|
||||||
|
static inline struct htx_blk *__htx_get_head_blk(const struct htx *htx)
|
||||||
|
{
|
||||||
|
int32_t head = htx_get_head(htx);
|
||||||
|
|
||||||
|
return htx_get_blk(htx, head);
|
||||||
|
}
|
||||||
|
|
||||||
/* Returns the type of the oldest HTX block (head) if the HTX message is not
|
/* Returns the type of the oldest HTX block (head) if the HTX message is not
|
||||||
* empty. Otherwise it returns HTX_BLK_UNUSED.
|
* empty. Otherwise it returns HTX_BLK_UNUSED.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user