]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
libasprintf: On mingw, really use our vasprintf function, not mingw_vasprintf.
authorBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:10:44 +0000 (02:10 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:10:44 +0000 (02:10 +0100)
mingw now has a definition of 'vasprintf' in <stdio.h> that redirects to
mingw_vasprintf, which does not support argument reordering (i.e.
HAVE_POSIX_PRINTF is not defined). Make sure to avoid this function and use
the one defined in our lib-asprintf.c instead.

* gettext-runtime/libasprintf/lib-asprintf.h (asprintf): Define as macro
redirecting to libasprintf_asprintf.
(vasprintf): Define as macro redirecting to libasprintf_vasprintf.
* gettext-runtime/libasprintf/lib-asprintf.c: Define also libasprintf_asprintf
and libasprintf_vasprintf.
* gettext-runtime/libasprintf/autosprintf.cc: Include lib-asprintf.h last.

gettext-runtime/libasprintf/autosprintf.cc
gettext-runtime/libasprintf/lib-asprintf.c
gettext-runtime/libasprintf/lib-asprintf.h

index 094770695cec1239779cb067a4f035fab2f2c923..4c3276298bbbeabaad33fdc84fb3bb034ffb4a81 100644 (file)
@@ -28,7 +28,6 @@
 #include <stdarg.h>
 #include <stdlib.h>
 #include <string.h>
-#include "lib-asprintf.h"
 
 /* std::swap() is in <utility> since C++11.  */
 #if __cplusplus >= 201103L
 # include <algorithm>
 #endif
 
+/* This include must come last, since it contains overrides of functions that
+   the system may provide (namely, vasprintf).  */
+#include "lib-asprintf.h"
+
 namespace gnu
 {
 
index 0cab6225a03191194b961f31cdd59614153e7d8b..54649659bca5a800c2154257980b04e88754a5a1 100644 (file)
@@ -1,5 +1,5 @@
 /* Library functions for class autosprintf.
-   Copyright (C) 2002-2003, 2006, 2015-2016 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2006, 2018 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
 #include "vasnprintf.c"
 #include "asnprintf.c"
 
+/* Define to the same symbols as in lib-asprintf.h.  */
+#define asprintf libasprintf_asprintf
+#define vasprintf libasprintf_vasprintf
+
 /* Define functions declared in "vasprintf.h".  */
 #include "vasprintf.c"
 #include "asprintf.c"
 
+/* Define the same functions also without the 'libasprintf_' prefix,
+   for binary backward-compatibility.  */
+#undef asprintf
+#undef vasprintf
+#include "vasprintf.c"
+#include "asprintf.c"
+
 #endif
index 8d6497ef85870b8743ebcd4771ad2edb2ce509c9..1ad8b90f74273b15d9504cd7fe392d8299ee46d3 100644 (file)
@@ -1,5 +1,5 @@
 /* Library functions for class autosprintf.
-   Copyright (C) 2002-2003, 2015-2016 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2018 Free Software Foundation, Inc.
    Written by Bruno Haible <bruno@clisp.org>, 2002.
 
    This program is free software: you can redistribute it and/or modify
 
 #else
 
+/* Define to symbols that are guaranteed to not be defined by the system
+   header files.  */
+#define asprintf libasprintf_asprintf
+#define vasprintf libasprintf_vasprintf
+
 /* Get asprintf(), vasprintf() declarations.  */
 #include "vasprintf.h"