From 9ae9009edfc1024281deac2089e7f4a58159c15f Mon Sep 17 00:00:00 2001 From: David Coles Date: Tue, 25 Jun 2024 17:11:20 -0700 Subject: [PATCH] Define `setlinebuf` for MSVC According to `setbuf(3)`, `setlinebuf` is exactly equivalent to `setvbuf(stream, NULL, _IOLBF, 0)`. --- spa/plugins/support/logger.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spa/plugins/support/logger.c b/spa/plugins/support/logger.c index 1df503cc8..5db83eeb6 100644 --- a/spa/plugins/support/logger.c +++ b/spa/plugins/support/logger.c @@ -22,6 +22,10 @@ #if defined(__FreeBSD__) || defined(__MidnightBSD__) #define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC +#elif defined(_MSC_VER) +static inline void setlinebuf(FILE* stream) { + setvbuf(stream, NULL, _IOLBF, 0); +} #endif #undef SPA_LOG_TOPIC_DEFAULT