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=Djj+5LzE; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id A06D65A004E for ; Fri, 13 Dec 2024 13:02:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1734091323; bh=VYhaN8ET0sy0l4PaOr40bMlU018IWugcoFBXQCuCZmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Djj+5LzEVrjyu/42WULNKhS/Ssaecdif9eOkQudvy1jNJqIXQroXCAO4r64HmZOd3 uXfQIUFwkjK9xHFxfUL8EGx8yqL23BAitoN2ngHR4cLa7RX0gJA+hjSlkyM3ofVRYO +u8f69OhBaQHcd24iJzpvb2juHh6rIcIvYkcGifBgWf5X6nZldxgZsRQq8nB6IfNBd Qkqi/dTlUGUCUjg+IamUmXSCrcjG1py70i7BHGPhRV9/FJnOIRXd8Hsp9vYWWw30H1 vrC3ZDPyuuaYEnMfEol6k8mj4xcKxqrAQNOOcoMrsPLFkcdGw7ocir7WWjXY7hgLuC oUac8f/S7uLIA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Y8ny36cx9z4wdF; Fri, 13 Dec 2024 23:02:03 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 1/3] packet: Use flexible array member in struct pool Date: Fri, 13 Dec 2024 23:01:54 +1100 Message-ID: <20241213120156.4123972-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241213120156.4123972-1-david@gibson.dropbear.id.au> References: <20241213120156.4123972-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: WFFOV5EAHMTPRFIPYTHQKUM6X5JK22ZV X-Message-ID-Hash: WFFOV5EAHMTPRFIPYTHQKUM6X5JK22ZV 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