diff --git a/src/unix/error.c b/src/unix/error.c index 2c1ccf12..a18c3142 100644 --- a/src/unix/error.c +++ b/src/unix/error.c @@ -120,24 +120,3 @@ uv_err_code uv_translate_sys_error(int sys_errno) { assert(0 && "unreachable"); return -1; } - - -/* TODO Pull in error messages so we don't have to - * a) rely on what the system provides us - * b) reverse-map the error codes - */ -#define UV_STRERROR_GEN(val, name, s) case UV_##name : return s; -const char* uv_strerror(uv_err_t err) { - int errorno; - - if (err.code == UV_EADDRINFO) { - return gai_strerror(errorno); - } - - switch (err.code) { - UV_ERRNO_MAP(UV_STRERROR_GEN) - default: - return strerror(err.sys_errno_); - } -} -#undef UV_STRERROR_GEN diff --git a/src/uv-common.c b/src/uv-common.c index 20f8bca6..3143bd2d 100644 --- a/src/uv-common.c +++ b/src/uv-common.c @@ -62,6 +62,17 @@ const char* uv_err_name(uv_err_t err) { #undef UV_ERR_NAME_GEN +#define UV_STRERROR_GEN(val, name, s) case UV_##name : return s; +const char* uv_strerror(uv_err_t err) { + switch (err.code) { + UV_ERRNO_MAP(UV_STRERROR_GEN) + default: + return "Unknown system error"; + } +} +#undef UV_STRERROR_GEN + + void uv__set_error(uv_loop_t* loop, uv_err_code code, int sys_error) { loop->last_err.code = code; loop->last_err.sys_errno_ = sys_error; diff --git a/src/win/error.c b/src/win/error.c index 5277583a..3db97a10 100644 --- a/src/win/error.c +++ b/src/win/error.c @@ -64,20 +64,6 @@ void uv_fatal_error(const int errorno, const char* syscall) { } -/* TODO: thread safety */ -static char* last_err_str_ = NULL; - -#define UV_STRERROR_GEN(val, name, s) case UV_##name : return s; -const char* uv_strerror(uv_err_t err) { - switch (err.code) { - UV_ERRNO_MAP(UV_STRERROR_GEN) - default: - return "Unknown system error"; - } -} -#undef UV_STRERROR_GEN - - uv_err_code uv_translate_sys_error(int sys_errno) { switch (sys_errno) { case ERROR_SUCCESS: return UV_OK;