configure: pass non-null pointer to (v)asprintf
authorSitsofe Wheeler <sitsofe@yahoo.com>
Wed, 19 Aug 2020 22:02:48 +0000 (23:02 +0100)
committerSitsofe Wheeler <sitsofe@yahoo.com>
Sat, 12 Sep 2020 10:05:38 +0000 (11:05 +0100)
Windows clang warns about redefinition of (v)asprintf when targeting
Windows 7 because the configure test failed due to passing NULL when to
those functions when they tag key parameters with the nonnull attribute.

Signed-off-by: Sitsofe Wheeler <sitsofe@yahoo.com>
configure

index 08571fb0d7996731091d13d8125a9635f755092d..79a5134d6c36081e9b043d9af5fb97322b475ce1 100755 (executable)
--- a/configure
+++ b/configure
@@ -939,7 +939,8 @@ cat > $TMPC << EOF
 
 int main(int argc, char **argv)
 {
-  return asprintf(NULL, "%s", "str") == 0;
+  char *buf;
+  return asprintf(&buf, "%s", "str") == 0;
 }
 EOF
 if compile_prog "" "" "have_asprintf"; then
@@ -956,7 +957,8 @@ cat > $TMPC << EOF
 int main(int argc, char **argv)
 {
   va_list ap;
-  return vasprintf(NULL, "%s", ap) == 0;
+  char *buf;
+  return vasprintf(&buf, "%s", ap) == 0;
 }
 EOF
 if compile_prog "" "" "have_vasprintf"; then