replace ifdef WIN with ifdef __unix__

This commit is contained in:
ado 2021-02-21 22:25:58 +01:00
parent 3578e7b99c
commit 43e4e8a9de

View File

@ -16,7 +16,11 @@ inline void assert_string_error_defined() {
"'string_error' needs to be enabled to use 'error_msg'");
}
#if defined(_WIN64) || defined(_WIN32)
#if __unix__
inline ssize_t get_line(char** lineptr, size_t* n, FILE* stream) {
return getline(lineptr, n, stream);
}
#else
#include <cstdint>
using ssize_t = int64_t;
inline ssize_t get_line(char** lineptr, size_t* n, FILE* stream) {
@ -67,10 +71,6 @@ inline ssize_t get_line(char** lineptr, size_t* n, FILE* stream) {
(*lineptr)[pos] = '\0';
return pos;
}
#else
inline ssize_t get_line(char** lineptr, size_t* n, FILE* stream) {
return getline(lineptr, n, stream);
}
#endif
} /* ss */