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=202412 header.b=pRaokV73; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 674C45A061B for ; Fri, 20 Dec 2024 09:58:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1734685098; bh=VYhaN8ET0sy0l4PaOr40bMlU018IWugcoFBXQCuCZmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pRaokV73j75V/g4ZK5h2Buvt4QLmNBybJ7a4IUcKdGlGL7eeei6IizG/jXKPohvwZ D1uuLyR1VueK+YqpwmOMvY5wQh1EUVLpz+YQFa4/YDN+D0sjo2QrNM+W9t1Erw6sbW i1XlOpoVbS/gnPXemh0KUdfNQoXDfYQLKdW9g6bvQLF+CTuqig5KHj8GNIC8trdro7 VHgkIan1dTuhc5xJXNF7Ubi44n0DxIaNbbdXiwJwbMq5gkixsGnXaOJkLs/JDB4iaW b6UW91FgAIfxKl/63a58JEoIHC5oOP83Yal+QlJY8/sj+VgUFbcK+jS3WGu4WCb01L gj8i1hYtF/0iw== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YF1Xp0wRwz4x6V; Fri, 20 Dec 2024 19:58:18 +1100 (AEDT) From: David Gibson To: Stefano Brivio , passt-dev@passt.top Subject: [PATCH v2 04/12] packet: Use flexible array member in struct pool Date: Fri, 20 Dec 2024 19:35:27 +1100 Message-ID: <20241220083535.1372523-5-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241220083535.1372523-1-david@gibson.dropbear.id.au> References: <20241220083535.1372523-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: KZFUMPN6TTSP5QU4DPZZCW3PFSPWGNSQ X-Message-ID-Hash: KZFUMPN6TTSP5QU4DPZZCW3PFSPWGNSQ 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: Currently we have a dummy pkt[1] array, which we alias with an array of a different size via various macros. However, we already require C11 which includes flexible array members, so we can do better. Signed-off-by: David Gibson --- packet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packet.h b/packet.h index 3f70e949..85ee5508 100644 --- a/packet.h +++ b/packet.h @@ -21,7 +21,7 @@ struct pool { size_t buf_size; size_t size; size_t count; - struct iovec pkt[1]; + struct iovec pkt[]; }; int vu_packet_check_range(void *buf, size_t offset, size_t len, -- 2.47.1