mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Avoid including unistd.h and replace write(STDERR) with fputs(stderr) (#40177)
This commit is contained in:
committed by
GitHub
parent
3eba144b83
commit
3d08df9f3c
@@ -15,13 +15,11 @@
|
||||
#include "llvm/ADT/StringRef.h"
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
#else
|
||||
# include <stdio.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
@@ -49,7 +47,8 @@ void error(const char *fmt, ...) {
|
||||
#define STDERR_FILENO 2
|
||||
_write(STDERR_FILENO, buffer, strlen(buffer));
|
||||
#else
|
||||
write(STDERR_FILENO, buffer, strlen(buffer));
|
||||
fputs(buffer, stderr);
|
||||
fflush(stderr);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user