From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6E2A843DFB; Thu, 4 Apr 2024 19:15:30 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 701D940A67; Thu, 4 Apr 2024 19:15:19 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id EF0D2402BC for ; Thu, 4 Apr 2024 19:15:14 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4822220E94A4; Thu, 4 Apr 2024 10:15:14 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4822220E94A4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1712250914; bh=H9j1fCv2LwSunEdLuRN66u3MaK9xk9Z6hwEsohm2ZI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psohcYos9LHnXTvrhygvbkViw+ZINStGToUllTgQh9NmBz8vMW6O3BGBWemWw0oIS T8xJcir7bLXjMlokCztZb8R9tmzItSk5BTpSMVPygxJtBrI0aYI1nQ9ReKBmtEAFEH Fipy1nngfeTOtfg4Y/kp2nb/F8JOBvktSLMmVZ6k= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Stephen Hemminger , Thomas Monjalon , =?UTF-8?q?Morten=20Br=C3=B8rup?= , Tyler Retzlaff Subject: [PATCH 1/4] latencystats: use alloca instead of vla trivial Date: Thu, 4 Apr 2024 10:15:10 -0700 Message-Id: <1712250913-1977-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1712250913-1977-1-git-send-email-roretzla@linux.microsoft.com> References: <20231107193220.GA15232@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <1712250913-1977-1-git-send-email-roretzla@linux.microsoft.com> X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org RFC sample illustrating simple conversion of VLA to alloca(). Signed-off-by: Tyler Retzlaff --- lib/latencystats/rte_latencystats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 4ea9b0d..f59a9eb 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -159,7 +159,7 @@ struct latency_stats_nameoff { { unsigned int i, cnt = 0; uint64_t now; - float latency[nb_pkts]; + float *latency = alloca(sizeof(float) * nb_pkts); static float prev_latency; /* * Alpha represents degree of weighting decrease in EWMA, -- 1.8.3.1