diff options
Diffstat (limited to 'gl/stdio-consolesafe.c')
| -rw-r--r-- | gl/stdio-consolesafe.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gl/stdio-consolesafe.c b/gl/stdio-consolesafe.c index 80561a6d..f634de13 100644 --- a/gl/stdio-consolesafe.c +++ b/gl/stdio-consolesafe.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* msvcrt workarounds. | 1 | /* msvcrt workarounds. |
| 2 | Copyright (C) 2025 Free Software Foundation, Inc. | 2 | Copyright (C) 2025-2026 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is free software: you can redistribute it and/or modify | 4 | This file is free software: you can redistribute it and/or modify |
| 5 | it under the terms of the GNU Lesser General Public License as | 5 | it under the terms of the GNU Lesser General Public License as |
| @@ -85,7 +85,7 @@ gl_consolesafe_fwrite (const void *ptr, size_t size, size_t nmemb, FILE *fp) | |||
| 85 | specifiers as the mingw *printf functions. */ | 85 | specifiers as the mingw *printf functions. */ |
| 86 | 86 | ||
| 87 | static int | 87 | static int |
| 88 | vasprintf (char **resultp, const char *format, va_list args) | 88 | local_vasprintf (char **resultp, const char *format, va_list args) |
| 89 | { | 89 | { |
| 90 | /* First try: Use a stack-allocated buffer. */ | 90 | /* First try: Use a stack-allocated buffer. */ |
| 91 | char buf[2048]; | 91 | char buf[2048]; |
| @@ -123,6 +123,9 @@ vasprintf (char **resultp, const char *format, va_list args) | |||
| 123 | return nbytes; | 123 | return nbytes; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | # undef vasprintf | ||
| 127 | # define vasprintf local_vasprintf | ||
| 128 | |||
| 126 | # endif | 129 | # endif |
| 127 | 130 | ||
| 128 | /* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt, | 131 | /* Bypass the functions __mingw_[v][f]printf, that trigger a bug in msvcrt, |
| @@ -133,8 +136,8 @@ int | |||
| 133 | gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...) | 136 | gl_consolesafe_fprintf (FILE *restrict fp, const char *restrict format, ...) |
| 134 | { | 137 | { |
| 135 | va_list args; | 138 | va_list args; |
| 136 | char *tmpstring; | ||
| 137 | va_start (args, format); | 139 | va_start (args, format); |
| 140 | char *tmpstring; | ||
| 138 | int result = vasprintf (&tmpstring, format, args); | 141 | int result = vasprintf (&tmpstring, format, args); |
| 139 | va_end (args); | 142 | va_end (args); |
| 140 | if (result >= 0) | 143 | if (result >= 0) |
| @@ -151,8 +154,8 @@ int | |||
| 151 | gl_consolesafe_printf (const char *restrict format, ...) | 154 | gl_consolesafe_printf (const char *restrict format, ...) |
| 152 | { | 155 | { |
| 153 | va_list args; | 156 | va_list args; |
| 154 | char *tmpstring; | ||
| 155 | va_start (args, format); | 157 | va_start (args, format); |
| 158 | char *tmpstring; | ||
| 156 | int result = vasprintf (&tmpstring, format, args); | 159 | int result = vasprintf (&tmpstring, format, args); |
| 157 | va_end (args); | 160 | va_end (args); |
| 158 | if (result >= 0) | 161 | if (result >= 0) |
