]> git.kaiwu.me - haproxy.git/commitdiff
CLEANUP: net_helper: fix incorrect const pointers in writev_n16()
authorWilly Tarreau <w@1wt.eu>
Thu, 30 Apr 2026 06:21:33 +0000 (08:21 +0200)
committerWilly Tarreau <w@1wt.eu>
Thu, 30 Apr 2026 06:21:33 +0000 (08:21 +0200)
It's interesting to see that output pointers p1 and p2 were declared
as const, and that thisremained unnoticed due to the explicit casts
to u8 when writing to them. The function is currently not used, but
better clean it up to avoid surprises.

include/haproxy/net_helper.h

index ee27ed483a2c4a34989d3247c3399c25d8a8964e..3e74e48e7e9b45e3df9ee7be636827330e302ac8 100644 (file)
@@ -360,7 +360,7 @@ static inline uint16_t readv_n16(const void *p1, size_t s1, const void *p2)
  * <p2>. <s1> may be zero and may be larger than the type. The caller is always
  * responsible for providing enough room.
  */
-static inline void writev_n16(const void *p1, size_t s1, const void *p2, const uint16_t u16)
+static inline void writev_n16(void *p1, size_t s1, void *p2, const uint16_t u16)
 {
        if (unlikely(s1 < 2)) {
                if (s1 == 0)