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=202512 header.b=sNxaD4q6; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 25F3C5A0657 for ; Mon, 05 Jan 2026 08:53:42 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202512; t=1767599619; bh=ElbRc4yVhYFTakNNhY9P2pD7lF+tEwLZFLsxqmrBKxk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sNxaD4q67BTjxzZ9t59FGcmhlfVuaSvec+o4h/37aZNI5l94LQOvXVXw0K4nJ7ss3 tQ72RnLa6aGvlvfY/jYDL0OkUcKRc7UhOt2rP2EHhnZ3Um4oiyD8d3XfheuIgwD0SR jVmy15vcHXZ8B+cHwBTmj1wrnQ0dTBJ1erYPcQ8PhCVjgwdnxDDityph+clTf9vPwH Wceskg7IyjpQv1Ul7L8HyVoDQdoq0GJeZPyRNoDKyOxG2z7aaIUZDUyV8C+LY/VVGd PxmHEDKlsovA4/YrL365VztofMHGoBQZaRI4MPZ6GFpU/XnoqMwbnQ1WMHeIVAxNjU PWWcLmhG6O51Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4dl64M1FRXz4wCx; Mon, 05 Jan 2026 18:53:39 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 2/5] migrate: Don't use terminator element for versions[] array Date: Mon, 5 Jan 2026 18:53:34 +1100 Message-ID: <20260105075337.1724962-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260105075337.1724962-1-david@gibson.dropbear.id.au> References: <20260105075337.1724962-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: FYKVZ3FLJZ4TQA2GME7L4KPE2KFOV6T7 X-Message-ID-Hash: FYKVZ3FLJZ4TQA2GME7L4KPE2KFOV6T7 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: When scanning the versions[] array we use a dummy entry to detect when we're finished. Use ARRAY_SIZE() instead, which is almost as easy, a little safer, and doesn't cause clang-tidy 21.1.7 to complain. Signed-off-by: David Gibson --- migrate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/migrate.c b/migrate.c index 48d63a07..18ca18a8 100644 --- a/migrate.c +++ b/migrate.c @@ -123,7 +123,6 @@ static const struct migrate_version versions[] = { * MSS and omitted timestamps, which meant it usually wouldn't work. * Therefore we don't attempt to support compatibility with it. */ - { 0 }, }; /* Current encoding version */ @@ -196,7 +195,7 @@ static const struct migrate_version *migrate_target_read_header(int fd) return NULL; } - for (v = versions; v->id; v++) + for (v = versions; (v - versions) < ARRAY_SIZE(versions); v++) if (v->id <= id && v->id >= compat_id) return v; -- 2.52.0