From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202602 header.b=R6lBLM5r; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B41655A0272 for ; Fri, 27 Mar 2026 05:34:36 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202602; t=1774586072; bh=KnGLtGuzZO+jq1p/DMLgvjM37L+IfDsig8eAH6HWAYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6lBLM5rNiKJQsWlu9mUbUswkzoTqCp2GJqXN30Zxwy8CUBFWVvituz0iTVrfWXgs U3uW30TyXDc9ruXThS9Q5yVWPAQhJfh9tDQfoxpUw+m2aHubOp8wcOEwK79icqO2Fn YJ2+LGWgpCFGpKmAmwDb2stBZ6wMfQcjLKZi0FPKQZ1wUGxd7YuLtRr1LY5zxLTisM YlLlG+bVYkB0GWv1VT0dfPJN0U+gij4rQpLib0oODhkMNvqZmWwpY9etGu7+2TCdUO /zlRh3ocwIIuh72v1l25wohDsJPxgK8yaupG2yoADCz4T+31kB2+OChsEOI4ef20Fv cB2kKh3MePqgA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4fhnqD4Z37z4wSr; Fri, 27 Mar 2026 15:34:32 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 02/18] fwd: Comparing rule can be const Date: Fri, 27 Mar 2026 15:34:14 +1100 Message-ID: <20260327043430.1785787-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260327043430.1785787-1-david@gibson.dropbear.id.au> References: <20260327043430.1785787-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: EWPPP7SCZE6UBCNGJP6HV3OE56PQ3SW2 X-Message-ID-Hash: EWPPP7SCZE6UBCNGJP6HV3OE56PQ3SW2 X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson 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: This pointer stepping through the array of existing rules can be const. For some reason cppcheck doesn't catch this at the moment, but does with certain changes we're looking at for the dynamic configuration client. Signed-off-by: David Gibson --- fwd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fwd.c b/fwd.c index f3b4bf2a..31058194 100644 --- a/fwd.c +++ b/fwd.c @@ -362,7 +362,7 @@ void fwd_rule_add(struct fwd_table *fwd, uint8_t proto, uint8_t flags, /* Check for any conflicting entries */ for (i = 0; i < fwd->count; i++) { char newstr[INANY_ADDRSTRLEN], rulestr[INANY_ADDRSTRLEN]; - struct fwd_rule *rule = &fwd->rules[i]; + const struct fwd_rule *rule = &fwd->rules[i]; if (proto != rule->proto) /* Non-conflicting protocols */ -- 2.53.0