From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=fail (p=quarantine dis=none) header.from=redhat.com Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 51BC95A0269 for ; Thu, 19 Nov 2026 13:49:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1795092561; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xpmNpHEW5psYj0Uqe7zvWRRAEWeGjTHmLQRbhqWxxEI=; b=WGPJQpr/DmhcDoidYzsgdLFwTU0rLSTkEojnP7c7tGfNRbTq73D6GwbFMF27nhuWq/4y1A hbZAedaxOvu6qXS1aVC2xS+2gxi0PdAVdyx/iGWuKMfrcNbPGE0OYcm0ImTkn4fJYJFe8D +/JdoZXIhUcCwu4Ax4tUu3rygfgIdS8= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-125-G-35ApARPU-d3SUX4y41NQ-1; Thu, 19 Nov 2026 07:49:19 -0500 X-MC-Unique: G-35ApARPU-d3SUX4y41NQ-1 X-Mimecast-MFC-AGG-ID: G-35ApARPU-d3SUX4y41NQ_1795092559 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D56801955BD9 for ; Thu, 19 Nov 2026 12:49:18 +0000 (UTC) Received: from lvivier-thinkpadp1gen8.rmtfr.csb (headnet04.pony-001.prod.iad2.dc.redhat.com [10.2.32.116]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 07B143001DA7; Thu, 19 Nov 2026 12:49:17 +0000 (UTC) From: Laurent Vivier To: passt-dev@passt.top Subject: [PATCH] cppcheck: Fix scope of the variable 'type_or_state' Date: Thu, 19 Nov 2026 13:49:16 +0100 Message-ID: <20261119124916.3150605-1-lvivier@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 2-oVFQZYL0iA6LeTUpkM6pFrxSzk7PTPl8wNcR4SJZ8_1795092559 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true Message-ID-Hash: PEN7B4QERN3FIYCRSZCTGEZMWJU4DQEH X-Message-ID-Hash: PEN7B4QERN3FIYCRSZCTGEZMWJU4DQEH X-MailFrom: lvivier@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Fix following cppcheck 2.22.0 error: flow.c:289:14: style: The scope of the variable 'type_or_state' can be reduced. [variableScope] Signed-off-by: Laurent Vivier --- flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flow.c b/flow.c index 27a24a4c253d..f9fbaefe761a 100644 --- a/flow.c +++ b/flow.c @@ -286,7 +286,6 @@ int flowside_connect(const struct ctx *c, int s, void flow_log__(const struct flow_common *f, int pri, bool perror, bool details, enum flow_state state, const char *fmt, ...) { - const char *type_or_state; int errno_ = errno; char msg[BUFSIZ]; va_list args; @@ -299,6 +298,8 @@ void flow_log__(const struct flow_common *f, int pri, bool perror, bool details, logmsg(!perror, false, pri, "Flow: not found, error: %s", msg); details = false; } else { + const char *type_or_state; + /* Show type if it's set, otherwise the state */ if (f->state < FLOW_STATE_TYPED) type_or_state = FLOW_STATE(f); -- 2.56.0