]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD/MINOR: peers: shut up a build warning introduced during last cleanup
authorWilly Tarreau <w@1wt.eu>
Tue, 29 Jan 2019 16:45:23 +0000 (17:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Tue, 29 Jan 2019 16:45:23 +0000 (17:45 +0100)
A new warning appears when building at -O0 since commit 3f0fb9df6 ("MINOR:
peers: move "hello" message treatment code to reduce the size of the I/O
handler."), it is related to the fact that proto_len is initialized from
strlen() which is not a constant. Let's replace it with sizeof-1 instead
and also mark the variable as static since it's useless outside of the file.

src/peers.c

index 2830e9e39e726e99a3e6e3678bbfe7f40481e51d..bca56aa1d4ed2b96cd546f1544f2a439c0030be6 100644 (file)
@@ -199,7 +199,7 @@ enum {
 #define PEER_MINOR_VER        1
 #define PEER_DWNGRD_MINOR_VER 0
 
-size_t proto_len = strlen(PEER_SESSION_PROTO_NAME);
+static size_t proto_len = sizeof(PEER_SESSION_PROTO_NAME) - 1;
 struct peers *cfg_peers = NULL;
 static void peer_session_forceshutdown(struct appctx *appctx);