]> git.kaiwu.me - haproxy.git/commitdiff
REORG: htx: Move functions to deal with first block after ones about next block
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 23 Jul 2026 08:35:06 +0000 (10:35 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Fri, 4 Sep 2026 08:24:29 +0000 (10:24 +0200)
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

index 6495b507486061ca1f0a82319dddee968225d16a..70f5f1f513d11e749a8ddc0806b92b5f73f074b7 100644 (file)
@@ -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 <htx>. -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 <htx>. If unset or if <htx> 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 <htx>. If unset or if
- * <htx> 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 <pos>. If
  * the message is empty or if <pos> 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 <htx>. -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 <htx>. If unset or if <htx> 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 <htx>. If unset or if
+ * <htx> 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 <blk> is the block is the only one inside the HTX message <htx>,
  * excluding all unused blocks. Otherwise, it returns 0. If 1 is returned, this
  * means that there is only <blk> and eventually some unused ones in <htx>.