[PATCH] Replace variable arrays in tests with VARIABLE_ARRAY

Mike Hommey mh+jemalloc at glandium.org
Wed May 21 01:24:08 PDT 2014


From: Mike Hommey <mh at glandium.org>

---
 test/unit/hash.c    | 4 ++--
 test/unit/mallctl.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/unit/hash.c b/test/unit/hash.c
index abb394a..77a8ced 100644
--- a/test/unit/hash.c
+++ b/test/unit/hash.c
@@ -64,8 +64,8 @@ hash_variant_verify(hash_variant_t variant)
 {
 	const size_t hashbytes = hash_variant_bits(variant) / 8;
 	uint8_t key[256];
-	uint8_t hashes[hashbytes * 256];
-	uint8_t final[hashbytes];
+	VARIABLE_ARRAY(uint8_t, hashes, hashbytes * 256);
+	VARIABLE_ARRAY(uint8_t, final, hashbytes);
 	unsigned i;
 	uint32_t computed, expected;
 
diff --git a/test/unit/mallctl.c b/test/unit/mallctl.c
index cb12049..7a8b55f 100644
--- a/test/unit/mallctl.c
+++ b/test/unit/mallctl.c
@@ -285,7 +285,7 @@ TEST_BEGIN(test_arenas_initialized)
 	assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
 	    "Unexpected mallctl() failure");
 	{
-		bool initialized[narenas];
+		VARIABLE_ARRAY(bool, initialized, narenas);
 
 		sz = narenas * sizeof(bool);
 		assert_d_eq(mallctl("arenas.initialized", initialized, &sz,
-- 
2.0.0.rc2



More information about the jemalloc-discuss mailing list