Fix to checked-build reference auditing
authorAndi McClure <andi.mcclure@xamarin.com>
Mon, 9 Nov 2015 16:08:58 +0000 (11:08 -0500)
committerAndi McClure <andi.mcclure@xamarin.com>
Mon, 9 Nov 2015 16:08:58 +0000 (11:08 -0500)
Remove an array idiom which both broke the GCC build (apparently Clang allows some things with variable-length arrays in "gnu99" mode which GCC does not) and wasn't right anyway (there was a typo which caused a read past end of buffer).

mono/metadata/image.c

index 3013a3e6fe64581702a87cbfba2b37b72316362a..a90bb66ae3e5c2e75ae59d71887e1725a0437456 100644 (file)
@@ -2578,10 +2578,9 @@ mono_find_mempool_owner (void *ptr)
        gboolean searching = TRUE;
 
        // Iterate over both by-path image hashes
-       const int hash_count = 2;
-       const int hash_candidates[hash_count] = {IMAGES_HASH_PATH, IMAGES_HASH_PATH_REFONLY};
+       const int hash_candidates[] = {IMAGES_HASH_PATH, IMAGES_HASH_PATH_REFONLY};
        int hash_idx;
-       for (hash_idx = 0; searching && hash_idx < IMAGES_HASH_COUNT; hash_idx++)
+       for (hash_idx = 0; searching && hash_idx < G_N_ELEMENTS (hash_candidates); hash_idx++)
        {
                GHashTable *target = loaded_images_hashes [hash_candidates [hash_idx]];
                GHashTableIter iter;