From 7cbf283090ec273c006a14129eee8bba1885da58 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Sun, 10 Feb 2013 20:16:17 +0100 Subject: Cast NULL in void * in functions using va_arg NULL isn't necessary a zero value. For instance, on AMD64 architecture, a null pointer is 0x7fff00000000. Usually things works automagically as the compiler always cast NULL and 0 in void * if stored in a pointer variable. But with functions with variable number of arguments the compiler can't know the type of the arguments and thus don't make the cast. In consequences, NULL and 0 must be cast explicitely in void * if the parameter is a pointer. --- test/vformat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/vformat.c b/test/vformat.c index b4a753d..40c299e 100644 --- a/test/vformat.c +++ b/test/vformat.c @@ -489,19 +489,19 @@ static void check_extract_fields( } printf(" Looking for {%s, %s}...\n", p_array[0], p_array[1]); - if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[1], NULL)) + if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[1], (void *) NULL)) { print_search_results(p_tmp); } printf(" Looking for {%s, %s}...\n", p_array[0], p_array[2]); - if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[2], NULL)) + if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[2], (void *) NULL)) { print_search_results(p_tmp); } printf(" Looking for {%s, %s, %s}...\n", p_array[0], p_array[1], p_array[2]); - if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[1], p_array[2], NULL)) + if (vf_get_property(&p_tmp, p_object, VFGP_FIND, NULL, p_array[0], p_array[1], p_array[2], (void *) NULL)) { print_search_results(p_tmp); } -- cgit v1.1-32-gdbae