From: Willy Tarreau Date: Tue, 31 May 2022 06:53:25 +0000 (+0200) Subject: CLEANUP: peers/cli: stop misusing the appctx local variable X-Git-Tag: v2.6.0~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fc5059958f4c6d711b872424f4b497c4c9413ef1;p=thirdparty%2Fhaproxy.git CLEANUP: peers/cli: stop misusing the appctx local variable In the context of a CLI command, it's particularly not welcome to use an "appctx" variable that is not the current one. In addition it was created for use at exactly 6 places in 2 lines. Let's just remove it and stick to peer->appctx which is used elsewhere in the function and is unambiguous. --- diff --git a/src/peers.c b/src/peers.c index 6dfa35f8e4..ae829e2a71 100644 --- a/src/peers.c +++ b/src/peers.c @@ -3777,7 +3777,6 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *sc, struct peer *p char pn[INET6_ADDRSTRLEN]; struct stconn *peer_cs; struct stream *peer_s; - struct appctx *appctx; struct shared_table *st; addr_to_str(&peer->addr, pn, sizeof pn); @@ -3810,12 +3809,12 @@ static int peers_dump_peer(struct buffer *msg, struct stconn *sc, struct peer *p chunk_appendf(&trash, " flags=0x%x", peer->flags); - appctx = peer->appctx; - if (!appctx) + if (!peer->appctx) goto table_info; - chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", appctx, appctx->st0, appctx->st1, - appctx->t ? appctx->t->calls : 0); + chunk_appendf(&trash, " appctx:%p st0=%d st1=%d task_calls=%u", + peer->appctx, peer->appctx->st0, peer->appctx->st1, + peer->appctx->t ? peer->appctx->t->calls : 0); peer_cs = appctx_sc(peer->appctx); peer_s = __sc_strm(peer_cs);