The problem is that on some platforms we call the function
without having provided a prototype for it. This breaks when
building with `-Werror`.
Now we declare it in the private `vasprintf.h` header when
the platform doesn't have a declaration in `stdio.h`. This
should also let us remove the hack in `glib.h` for MSVC.
This may or may not break the build on some platforms; I've
tried on those that I have access to with success. Let me
know if this breaks anything.
#include <string.h>
#include <glib.h>
+#include "vasprintf.h"
+
GError *
g_error_new (gpointer domain, gint code, const char *format, ...)
{
G_BEGIN_DECLS
-#ifdef G_OS_WIN32
-/* MSC and Cross-compilatin will use this */
-int vasprintf (char **strp, const char *fmt, va_list ap);
-#endif
-
-
/*
* Basic data types
*/
#include <stdlib.h>
#include <glib.h>
+#include "vasprintf.h"
+
/* The current fatal levels, error is always fatal */
static GLogLevelFlags fatal = G_LOG_LEVEL_ERROR;
#include <ctype.h>
#include <glib.h>
+#include "vasprintf.h"
+
/* This is not a macro, because I dont want to put _GNU_SOURCE in the glib.h header */
gchar *
g_strndup (const gchar *str, gsize n)
--- /dev/null
+#ifndef __VASPRINTF_H
+#define __VASPRINTF_H
+
+#include <stdarg.h>
+#include <config.h>
+
+#ifndef HAVE_VASPRINTF
+int vasprintf(char **ret, const char *fmt, va_list ap);
+#endif
+
+#endif /* __VASPRINTF_H */