1
0
mirror of https://gitlab.com/80486DX2-66/gists synced 2024-12-27 05:40:17 +05:30

freadln.c: fix and improve SLEEP_FN definitions

This commit is contained in:
Intel A80486DX2-66 2024-04-07 17:34:24 +03:00
parent ede74a1195
commit 8f8ee0eb53
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -78,14 +78,14 @@ int freadln(FILE* f, char** output, size_t* length_out) {
#ifdef TEST #ifdef TEST
# if defined(_WIN32) || defined(WIN32) # if defined(_WIN32) || defined(WIN32)
# include <windows.h> # include <windows.h>
# define SLEEP_FN Sleep # define SLEEP_FN(x) Sleep((DWORD) x)
# define DO_SLEEP 1 # define DO_SLEEP 1
# elif defined(__CYGWIN__) || defined(__unix__) || defined(__APPLE__) && \ # elif defined(__CYGWIN__) || defined(__unix__) || defined(__APPLE__) && \
defined(__MACH__) || defined(__linux__) || defined(__FreeBSD__) || \ defined(__MACH__) || defined(__linux__) || defined(__FreeBSD__) || \
defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || \ defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) || \
defined(__DragonFly__) || defined(__MINGW32__) || defined(__MINGW64__) defined(__DragonFly__) || defined(__MINGW32__) || defined(__MINGW64__)
# include <unistd.h> # include <unistd.h>
# define SLEEP_FN usleep # define SLEEP_FN(x) usleep((x) * 1000ULL)
# define DO_SLEEP 1 # define DO_SLEEP 1
# else # else
# define SLEEP_FN(...) # define SLEEP_FN(...)