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

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

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff April 18, 2024, 8:02 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(-)
  

Patch

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. */