From 9400a77dcbe6f4c792da666d37ae967f344da45a Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Thu, 23 Jul 2026 10:35:06 +0200 Subject: [PATCH] REORG: htx: Move functions to deal with first block after ones about next block functions htx_get_first_* were moved after htx_get_next_*() ones. There is no change here but it is mandatory for the next commit. htx_get_first_blk() will rely on htx_get_next(). --- include/haproxy/htx.h | 58 +++++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/include/haproxy/htx.h b/include/haproxy/htx.h index c9bf073f3..4b7b9834f 100644 --- a/include/haproxy/htx.h +++ b/include/haproxy/htx.h @@ -262,35 +262,6 @@ static inline enum htx_blk_type htx_get_tail_type(const struct htx *htx) return (blk ? htx_get_blk_type(blk) : HTX_BLK_UNUSED); } -/* Returns the position of the first block in the HTX message . -1 means - * the first block is unset or the HTS is empty. - */ -static inline int32_t htx_get_first(const struct htx *htx) -{ - return htx->first; -} - -/* Returns the first HTX block in the HTX message . If unset or if is - * empty, NULL returned. - */ -static inline struct htx_blk *htx_get_first_blk(const struct htx *htx) -{ - int32_t pos; - - pos = htx_get_first(htx); - return ((pos == -1) ? NULL : htx_get_blk(htx, pos)); -} - -/* Returns the type of the first block in the HTX message . If unset or if - * is empty, HTX_BLK_UNUSED is returned. - */ -static inline enum htx_blk_type htx_get_first_type(const struct htx *htx) -{ - struct htx_blk *blk = htx_get_first_blk(htx); - - return (blk ? htx_get_blk_type(blk) : HTX_BLK_UNUSED); -} - /* Returns the position of block immediately before the one pointed by . If * the message is empty or if is the position of the head, -1 returned. */ @@ -336,6 +307,35 @@ static inline struct htx_blk *htx_get_next_blk(const struct htx *htx, return ((pos == -1) ? NULL : htx_get_blk(htx, pos)); } +/* Returns the position of the first block in the HTX message . -1 means + * the first block is unset or the HTS is empty. + */ +static inline int32_t htx_get_first(const struct htx *htx) +{ + return htx->first; +} + +/* Returns the first HTX block in the HTX message . If unset or if is + * empty, NULL returned. + */ +static inline struct htx_blk *htx_get_first_blk(const struct htx *htx) +{ + int32_t pos; + + pos = htx_get_first(htx); + return ((pos == -1) ? NULL : htx_get_blk(htx, pos)); +} + +/* Returns the type of the first block in the HTX message . If unset or if + * is empty, HTX_BLK_UNUSED is returned. + */ +static inline enum htx_blk_type htx_get_first_type(const struct htx *htx) +{ + struct htx_blk *blk = htx_get_first_blk(htx); + + return (blk ? htx_get_blk_type(blk) : HTX_BLK_UNUSED); +} + /* Returns 1 if is the block is the only one inside the HTX message , * excluding all unused blocks. Otherwise, it returns 0. If 1 is returned, this * means that there is only and eventually some unused ones in . -- 2.47.3