cedric pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=9d1504dba11ed3d7c7f6c82fb1d1b5a7acbe4474
commit 9d1504dba11ed3d7c7f6c82fb1d1b5a7acbe4474 Author: Adrien Nader <adr...@notk.org> Date: Wed Feb 11 12:09:59 2015 +0100 eina: remove Eina_Counter and use provided Windows posix compatible implementation. --- src/lib/eina/eina_counter.c | 49 -------------------------------------- src/lib/eina/eina_inline_private.h | 27 --------------------- src/lib/eina/eina_main.c | 3 --- 3 files changed, 79 deletions(-) diff --git a/src/lib/eina/eina_counter.c b/src/lib/eina/eina_counter.c index 084788e..533d215 100644 --- a/src/lib/eina/eina_counter.c +++ b/src/lib/eina/eina_counter.c @@ -68,9 +68,6 @@ struct _Eina_Clock Eina_Bool valid; }; -#ifdef _WIN32 -LARGE_INTEGER _eina_counter_frequency; -#endif static char * _eina_counter_asiprintf(char *base, int *position, const char *format, ...) @@ -117,52 +114,6 @@ _eina_counter_asiprintf(char *base, int *position, const char *format, ...) */ /*============================================================================* - * Global * - *============================================================================*/ - -/** - * @internal - * @brief Initialize the eina counter internal structure. - * - * @return #EINA_TRUE on success, #EINA_FALSE on failure. - * - * This function shuts down the counter module set up by - * eina_counter_init(). It is called by eina_init(). - * - * This function sets up the error module of Eina and only on Windows, - * it initializes the high precision timer. It is also called - * by eina_init(). It returns 0 on failure, otherwise it returns the - * number of times it has already been called. - * - * @see eina_init() - */ -Eina_Bool -eina_counter_init(void) -{ -#ifdef _WIN32 - if (!QueryPerformanceFrequency(&_eina_counter_frequency)) return EINA_FALSE; -#endif /* _WIN2 */ - return EINA_TRUE; -} - -/** - * @internal - * @brief Shut down the counter module. - * - * @return #EINA_TRUE on success, #EINA_FALSE on failure. - * - * This function shuts down the counter module set up by - * eina_counter_init(). It is called by eina_shutdown(). - * - * @see eina_shutdown() - */ -Eina_Bool -eina_counter_shutdown(void) -{ - return EINA_TRUE; -} - -/*============================================================================* * API * *============================================================================*/ diff --git a/src/lib/eina/eina_inline_private.h b/src/lib/eina/eina_inline_private.h index 752baa0..846081d 100644 --- a/src/lib/eina/eina_inline_private.h +++ b/src/lib/eina/eina_inline_private.h @@ -19,27 +19,14 @@ #ifndef EINA_INLINE_PRIVATE_H_ # define EINA_INLINE_PRIVATE_H_ -#ifndef _WIN32 # include <time.h> # include <sys/time.h> -#else -# define WIN32_LEAN_AND_MEAN -# include <windows.h> -# undef WIN32_LEAN_AND_MEAN -#endif /* _WIN2 */ -#ifndef _WIN32 typedef struct timespec Eina_Nano_Time; -#else -typedef LARGE_INTEGER Eina_Nano_Time; - -extern LARGE_INTEGER _eina_counter_frequency; -#endif static inline int _eina_time_get(Eina_Nano_Time *tp) { -#ifndef _WIN32 # if defined(CLOCK_PROCESS_CPUTIME_ID) if (!clock_gettime(CLOCK_PROCESS_CPUTIME_ID, tp)) return 0; @@ -64,9 +51,6 @@ _eina_time_get(Eina_Nano_Time *tp) tp->tv_nsec = tv.tv_usec * 1000L; return 0; -#else - return QueryPerformanceCounter(tp); -#endif /* _WIN2 */ } static inline long int @@ -74,12 +58,7 @@ _eina_time_convert(Eina_Nano_Time *tp) { long int r; -#ifndef _WIN32 r = tp->tv_sec * 1000000000 + tp->tv_nsec; -#else - r = (long int)(((long long int)tp->QuadPart * 1000000000ll) / - (long long int)_eina_counter_frequency.QuadPart); -#endif return r; } @@ -89,14 +68,8 @@ _eina_time_delta(Eina_Nano_Time *start, Eina_Nano_Time *end) { long int r; -#ifndef _WIN32 r = (end->tv_sec - start->tv_sec) * 1000000000 + end->tv_nsec - start->tv_nsec; -#else - r = (long int)(((long long int)(end->QuadPart - start->QuadPart) - * 1000000000LL) - / (long long int)_eina_counter_frequency.QuadPart); -#endif return r; } diff --git a/src/lib/eina/eina_main.c b/src/lib/eina/eina_main.c index 7a9ec9f..aa39d27 100644 --- a/src/lib/eina/eina_main.c +++ b/src/lib/eina/eina_main.c @@ -60,7 +60,6 @@ #include "eina_list.h" #include "eina_matrixsparse.h" #include "eina_array.h" -#include "eina_counter.h" #include "eina_benchmark.h" #include "eina_magic.h" #include "eina_rectangle.h" @@ -138,7 +137,6 @@ EAPI Eina_Inlist *_eina_tracking = NULL; S(ustringshare); S(matrixsparse); S(convert); - S(counter); S(benchmark); S(rectangle); S(strbuf); @@ -183,7 +181,6 @@ static const struct eina_desc_setup _eina_desc_setup[] = { S(ustringshare), S(matrixsparse), S(convert), - S(counter), S(benchmark), S(rectangle), S(strbuf), --