From a41c5f7a0656f9b8a1b00bee65f03d2455ed6547 Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 8 May 2019 10:14:45 -0400 Subject: [PATCH] Evil: remove localtime_r as mingw-w64 defines it when _POSIX_C_SOURCE is defined Summary: localtime_r() is already defined by mingw-w64 when _POSIX_C_SOURCE is defined edit: also only define _POSIX_C_SOURCE (correctly) on windows Reviewers: bu5hm4n Reviewed By: bu5hm4n Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8859 --- configure.ac | 1 + meson.build | 1 + src/lib/evil/evil_macro_wrapper.h | 14 -------------- src/lib/evil/evil_time.c | 10 ---------- src/lib/evil/evil_time.h | 23 +++-------------------- 5 files changed, 5 insertions(+), 44 deletions(-) diff --git a/configure.ac b/configure.ac index 57ae1f51a5..4ca3d09e2b 100644 --- a/configure.ac +++ b/configure.ac @@ -298,6 +298,7 @@ if test "x${have_win32}" = "xyes" ; then # autotools macro and CXX is always set to g++ even if # it's not found. So we are using an internal variable # that does the work for now, may get broken in the future. + AC_DEFINE([_POSIX_C_SOURCE], [200809L], [Define the POSIX version]) if test "x${ac_ct_CXX}" = "x" -a "x${CXX}" = "xg++"; then AC_MSG_ERROR([efl requires a C++ compiler got ${ac_ct_CXX} and ${CXX}.]) fi diff --git a/meson.build b/meson.build index 2595461c62..e26d17e507 100644 --- a/meson.build +++ b/meson.build @@ -102,6 +102,7 @@ foreach lang : ['c', 'objc', 'cpp'] add_global_arguments('-DEFL_BUILD=1', language: lang) add_global_arguments('-DELM_INTERNAL_API_ARGESFSDFEFC=1', language: lang) if sys_windows == true + add_global_arguments('-D_POSIX_C_SOURCE=200809L', language: lang) if (get_option('windows-version') == 'vista') add_global_arguments('-DWINVER=0x060', language: lang) add_global_arguments('-D_WIN32_WINNT=0x0600', language: lang) diff --git a/src/lib/evil/evil_macro_wrapper.h b/src/lib/evil/evil_macro_wrapper.h index 19e68d3935..cd650e5e12 100644 --- a/src/lib/evil/evil_macro_wrapper.h +++ b/src/lib/evil/evil_macro_wrapper.h @@ -45,20 +45,6 @@ #endif #define mkdir(dirname, mode) evil_mkdir(dirname, mode) -/* - * evil_time.h - */ - -/** - * @def localtime_r(t, r) - * - * Wrapper around evil_localtime_r(). - */ -#ifdef localtime_r -# undef localtime_r -#endif -#define localtime_r(t, r) evil_localtime_r(t, r) - /* * evil_unistd.h */ diff --git a/src/lib/evil/evil_time.c b/src/lib/evil/evil_time.c index 76c5a58657..90b63692fc 100644 --- a/src/lib/evil/evil_time.c +++ b/src/lib/evil/evil_time.c @@ -12,16 +12,6 @@ #include "evil_macro_wrapper.h" #include "evil_private.h" -struct tm * -evil_localtime_r(const time_t *timep, struct tm *result) -{ - __time64_t t = *timep; - - _localtime64_s(result, &t); - - return result; -} - /* * strptime * based on http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/time/strptime.c?rev=HEAD diff --git a/src/lib/evil/evil_time.h b/src/lib/evil/evil_time.h index 34607de5d1..00f538cae7 100644 --- a/src/lib/evil/evil_time.h +++ b/src/lib/evil/evil_time.h @@ -2,6 +2,9 @@ #define __EVIL_TIME_H__ +#include + + /** * @file evil_time.h * @brief The file that provides functions ported from Unix in time.h. @@ -14,26 +17,6 @@ */ -/** - * @brief Convert the calendar time to broken-time representation in a - * user supplied data. - * - * @param timep The calender time. - * @param result The broken-down time representation. - * @return The broken-down time representation. - * - * This function converts the calendar time @p timep to a broken-time - * representation. The result is stored in the buffer @p result - * supplied by the user. If @p timep or @p result are @c NULL, or if - * an error occurred, this function returns @c NULL and the values in - * @p result might be undefined. Otherwise it returns @p result. - * - * Conformity: Non applicable. - * - * Supported OS: Windows XP. - */ -EAPI struct tm *evil_localtime_r(const time_t *timep, struct tm *result); - /** * @brief Convert a string representation of time to a time tm structure . *