summaryrefslogtreecommitdiffstats
path: root/gl/stdio-write.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/stdio-write.c')
-rw-r--r--gl/stdio-write.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/gl/stdio-write.c b/gl/stdio-write.c
index ca6aa00c..fc7f74fe 100644
--- a/gl/stdio-write.c
+++ b/gl/stdio-write.c
@@ -1,5 +1,5 @@
1/* POSIX compatible FILE stream write function. 1/* POSIX compatible FILE stream write function.
2 Copyright (C) 2008-2024 Free Software Foundation, Inc. 2 Copyright (C) 2008-2026 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2008. 3 Written by Bruno Haible <bruno@clisp.org>, 2008.
4 4
5 This file is free software: you can redistribute it and/or modify 5 This file is free software: you can redistribute it and/or modify
@@ -107,10 +107,9 @@
107 return (EXPRESSION); \ 107 return (EXPRESSION); \
108 else \ 108 else \
109 { \ 109 { \
110 RETTYPE ret; \
111 CLEAR_ERRNO \ 110 CLEAR_ERRNO \
112 CLEAR_LastError \ 111 CLEAR_LastError \
113 ret = (EXPRESSION); \ 112 RETTYPE ret = (EXPRESSION); \
114 if (FAILED) \ 113 if (FAILED) \
115 { \ 114 { \
116 HANDLE_ENOSPC \ 115 HANDLE_ENOSPC \
@@ -124,11 +123,9 @@
124int 123int
125printf (const char *format, ...) 124printf (const char *format, ...)
126{ 125{
127 int retval;
128 va_list args; 126 va_list args;
129
130 va_start (args, format); 127 va_start (args, format);
131 retval = vfprintf (stdout, format, args); 128 int retval = vfprintf (stdout, format, args);
132 va_end (args); 129 va_end (args);
133 130
134 return retval; 131 return retval;
@@ -139,11 +136,9 @@ printf (const char *format, ...)
139int 136int
140fprintf (FILE *stream, const char *format, ...) 137fprintf (FILE *stream, const char *format, ...)
141{ 138{
142 int retval;
143 va_list args; 139 va_list args;
144
145 va_start (args, format); 140 va_start (args, format);
146 retval = vfprintf (stream, format, args); 141 int retval = vfprintf (stream, format, args);
147 va_end (args); 142 va_end (args);
148 143
149 return retval; 144 return retval;
@@ -162,6 +157,9 @@ vprintf (const char *format, va_list args)
162int 157int
163vfprintf (FILE *stream, const char *format, va_list args) 158vfprintf (FILE *stream, const char *format, va_list args)
164#undef vfprintf 159#undef vfprintf
160#if defined __MINGW32__ && !defined _UCRT && __USE_MINGW_ANSI_STDIO
161# define vfprintf gl_consolesafe_vfprintf
162#endif
165{ 163{
166 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF) 164 CALL_WITH_SIGPIPE_EMULATION (int, vfprintf (stream, format, args), ret == EOF)
167} 165}
@@ -198,6 +196,9 @@ puts (const char *string)
198size_t 196size_t
199fwrite (const void *ptr, size_t s, size_t n, FILE *stream) 197fwrite (const void *ptr, size_t s, size_t n, FILE *stream)
200#undef fwrite 198#undef fwrite
199#if (defined _WIN32 && !defined __CYGWIN__) && !defined _UCRT
200# define fwrite gl_consolesafe_fwrite
201#endif
201{ 202{
202 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n) 203 CALL_WITH_SIGPIPE_EMULATION (size_t, fwrite (ptr, s, n, stream), ret < n)
203} 204}