]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: connection: Indicate unreachability to the compiler in conn_recv_proxy
authorTim Duesterhus <tim@bastelstu.be>
Fri, 25 Feb 2022 20:44:26 +0000 (21:44 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 28 Feb 2022 16:59:28 +0000 (17:59 +0100)
Transform the unreachability comment into a call to `my_unreachable()` to allow
the compiler from benefitting from it.

see d1b15b6e9 ("MINOR: proxy_protocol: Ingest PP2_TYPE_UNIQUE_ID on incoming connections")
see 615f81eb5 ("MINOR: connection: Use a `struct ist` to store proxy_authority")

src/connection.c

index 1d53eed79538000e6a84a7be21eb0d27a6d54d5e..f78028451ccdf36867305709540a81cf8253f726 100644 (file)
@@ -1073,9 +1073,8 @@ int conn_recv_proxy(struct connection *conn, int flag)
                                if (!isttest(conn->proxy_authority))
                                        goto fail;
                                if (istcpy(&conn->proxy_authority, tlv, PP2_AUTHORITY_MAX) < 0) {
-                                       /* This is technically unreachable, because we verified above
-                                        * that the TLV value fits.
-                                        */
+                                       /* This is impossible, because we verified that the TLV value fits. */
+                                       my_unreachable();
                                        goto fail;
                                }
                                break;
@@ -1087,9 +1086,8 @@ int conn_recv_proxy(struct connection *conn, int flag)
                                if (!isttest(conn->proxy_unique_id))
                                        goto fail;
                                if (istcpy(&conn->proxy_unique_id, tlv, UNIQUEID_LEN) < 0) {
-                                       /* This is technically unreachable, because we verified above
-                                        * that the TLV value fits.
-                                        */
+                                       /* This is impossible, because we verified that the TLV value fits. */
+                                       my_unreachable();
                                        goto fail;
                                }
                                break;