[v3,10/19] lpm: remove use of VLAs for Windows built code

Message ID 1715019531-22796-11-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State New
Delegated to: Thomas Monjalon
Series remove use of VLAs for Windows |


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff May 6, 2024, 6:18 p.m. UTC
  MSVC does not support VLAs, replace VLAs with standard C arrays
or alloca(). alloca() is available for all toolchain/platform
combinations officially supported by DPDK.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
 lib/lpm/rte_lpm.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/lib/lpm/rte_lpm.h b/lib/lpm/rte_lpm.h
index 2888e5f..fc5805c 100644
--- a/lib/lpm/rte_lpm.h
+++ b/lib/lpm/rte_lpm.h
@@ -337,7 +337,7 @@  struct rte_lpm *
 		uint32_t *next_hops, const unsigned n)
 	unsigned i;
-	unsigned tbl24_indexes[n];
+	unsigned int *tbl24_indexes = (unsigned int *)alloca(sizeof(unsigned int) * n);
 	const uint32_t *ptbl;
 	/* DEBUG: Check user input arguments. */