From 12e0ee8742c3da77848d79a7fe9d88242873f5bf Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 13 Mar 2019 09:53:17 -0400 Subject: [PATCH] eina_error: On Windows strerror_s() is the same than POSIX strerror_r() Summary: strerror_r() does not exist on Windows, but strerror_s() does Test Plan: compilation Reviewers: cedric, bu5hm4n, zmike Reviewed By: zmike Subscribers: zmike, bu5hm4n, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8279 --- src/lib/eina/eina_error.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/lib/eina/eina_error.c b/src/lib/eina/eina_error.c index a7faadeb3b..7922933e59 100644 --- a/src/lib/eina/eina_error.c +++ b/src/lib/eina/eina_error.c @@ -25,10 +25,6 @@ #include #include -#ifdef _WIN32 -# include -#endif - #include "eina_config.h" #include "eina_private.h" @@ -111,6 +107,18 @@ _eina_error_msg_alloc(void) return _eina_errors + idx; } +#ifdef _WIN32 +# define HAVE_STRERROR_R +# ifdef STRERROR_R_CHAR_P +# undef STRERROR_R_CHAR_P +# endif +/* Windows has strerror_s(), similar to POSIX strerror_r() */ +static inline int strerror_r(int errnum, char *buf, size_t buflen) +{ + return strerror_s(buf, buflen, errnum); +} +#endif + /** * @endcond */