mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 06:11:32 +02:00
MINOR: htx: never check for null htx pointer in htx_is_{,not_}empty()
The previous patch clarifies the fact that the htx pointer is never null along all the code. This test for a null will never match, didn't catch the pointer 1 before the fix for b_is_null(), but it confuses the compiler letting it think that any dereferences made to this pointer after this test could actually mean we're dereferencing a null. Let's now drop this test. This saves us from having to add impossible tests everywhere to avoid the warning. This should be backported to 1.9 if the b_is_null() patch is backported.
This commit is contained in:
parent
245d189cce
commit
e5fcfbed5c
@ -734,16 +734,20 @@ static inline void htx_to_buf(struct htx *htx, struct buffer *buf)
|
|||||||
b_set_data(buf, b_size(buf));
|
b_set_data(buf, b_size(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 1 if the message is empty, otherwise it returns 0. */
|
/* Returns 1 if the message is empty, otherwise it returns 0. Note that it is
|
||||||
|
* illegal to call this with htx == NULL.
|
||||||
|
*/
|
||||||
static inline int htx_is_empty(const struct htx *htx)
|
static inline int htx_is_empty(const struct htx *htx)
|
||||||
{
|
{
|
||||||
return (!htx || !htx->used);
|
return !htx->used;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns 1 if the message is not empty, otherwise it returns 0. */
|
/* Returns 1 if the message is not empty, otherwise it returns 0. Note that it
|
||||||
|
* is illegal to call this with htx == NULL.
|
||||||
|
*/
|
||||||
static inline int htx_is_not_empty(const struct htx *htx)
|
static inline int htx_is_not_empty(const struct htx *htx)
|
||||||
{
|
{
|
||||||
return (htx && htx->used);
|
return htx->used;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For debugging purpose */
|
/* For debugging purpose */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user