From 777844ae0c0c24720efc1288bb20f12b191e5bdf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 15 Dec 2013 18:30:25 +0100 Subject: system/SocketError, ...: use strerror() instead of g_strerror() Avoid GLib. --- src/command/CommandError.cxx | 7 +++---- src/system/FatalError.cxx | 5 ++++- src/system/SocketError.cxx | 4 ++-- src/util/Error.cxx | 7 +++++-- 4 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/command/CommandError.cxx b/src/command/CommandError.cxx index fc14d4a5d..c1ef09904 100644 --- a/src/command/CommandError.cxx +++ b/src/command/CommandError.cxx @@ -24,9 +24,8 @@ #include "util/Error.hxx" #include "Log.hxx" -#include - #include +#include #include CommandResult @@ -38,7 +37,7 @@ print_playlist_result(Client &client, PlaylistResult result) case PlaylistResult::ERRNO: command_error(client, ACK_ERROR_SYSTEM, "%s", - g_strerror(errno)); + strerror(errno)); return CommandResult::ERROR; case PlaylistResult::DENIED: @@ -115,7 +114,7 @@ print_error(Client &client, const Error &error) } } else if (error.IsDomain(errno_domain)) { command_error(client, ACK_ERROR_SYSTEM, "%s", - g_strerror(error.GetCode())); + strerror(error.GetCode())); return CommandResult::ERROR; } diff --git a/src/system/FatalError.cxx b/src/system/FatalError.cxx index f02b4b581..11a0944df 100644 --- a/src/system/FatalError.cxx +++ b/src/system/FatalError.cxx @@ -23,12 +23,15 @@ #include "util/Domain.hxx" #include "LogV.hxx" +#ifdef WIN32 #include +#endif #include #include #include #include +#include #ifdef WIN32 #include @@ -88,7 +91,7 @@ FatalSystemError(const char *msg) #ifdef WIN32 system_error = g_win32_error_message(GetLastError()); #else - system_error = g_strerror(errno); + system_error = strerror(errno); #endif FormatError(fatal_error_domain, "%s: %s", msg, system_error); diff --git a/src/system/SocketError.cxx b/src/system/SocketError.cxx index 315a86e1f..bb1fa5abf 100644 --- a/src/system/SocketError.cxx +++ b/src/system/SocketError.cxx @@ -21,7 +21,7 @@ #include "SocketError.hxx" #include "util/Domain.hxx" -#include +#include const Domain socket_domain("socket"); @@ -41,6 +41,6 @@ SocketErrorMessage::SocketErrorMessage(socket_error_t code) #else SocketErrorMessage::SocketErrorMessage(socket_error_t code) - :msg(g_strerror(code)) {} + :msg(strerror(code)) {} #endif diff --git a/src/util/Error.cxx b/src/util/Error.cxx index 5675f4d81..99695f0d1 100644 --- a/src/util/Error.cxx +++ b/src/util/Error.cxx @@ -21,11 +21,14 @@ #include "Error.hxx" #include "Domain.hxx" +#ifdef WIN32 #include +#endif #include #include #include +#include const Domain errno_domain("errno"); @@ -70,7 +73,7 @@ Error::FormatPrefix(const char *fmt, ...) void Error::SetErrno(int e) { - Set(errno_domain, e, g_strerror(e)); + Set(errno_domain, e, strerror(e)); } void @@ -82,7 +85,7 @@ Error::SetErrno() void Error::SetErrno(int e, const char *prefix) { - Format(errno_domain, e, "%s: %s", prefix, g_strerror(e)); + Format(errno_domain, e, "%s: %s", prefix, strerror(e)); } void -- cgit v1.2.3