Commit dbb4a5866fcbb121000a705e074f679445d6916b

Patrick Steinhardt 2018-10-05T10:27:33

tests: fix warning for implicit conversion of integer to pointer GCC warns by default when implicitly converting integers to pointers or the other way round, and commit fa48d2ea7 (vector: do not malloc 0-length vectors on dup, 2018-09-26) introduced such an implicit conversion into our vector tests. While this is totally fine in this test, as the pointer's value is never being used in the first place, we can trivially avoid the warning by instead just inserting a pointer for a variable allocated on the stack into the vector.

diff --git a/tests/core/vector.c b/tests/core/vector.c
index 6b8ea57..2be7e86 100644
--- a/tests/core/vector.c
+++ b/tests/core/vector.c
@@ -412,7 +412,7 @@ void test_core_vector__dup_empty_vector(void)
 {
 	git_vector v = GIT_VECTOR_INIT;
 	git_vector dup = GIT_VECTOR_INIT;
-	void *dummy = 0xDEAFBEEB;
+	int dummy;
 
 	cl_assert_equal_i(0, v.length);
 
@@ -420,7 +420,7 @@ void test_core_vector__dup_empty_vector(void)
 	cl_assert_equal_i(0, dup._alloc_size);
 	cl_assert_equal_i(0, dup.length);
 
-	cl_git_pass(git_vector_insert(&dup, dummy));
+	cl_git_pass(git_vector_insert(&dup, &dummy));
 	cl_assert_equal_i(8, dup._alloc_size);
 	cl_assert_equal_i(1, dup.length);