forked from enlightenment/efl
Evil: fix infinite recursive loop in previous addition of setlocale() in Evil
Summary: setlocale() called itself because it was defined as a #define so remove this #define from evil_locale.h and move it in another header file To avoid future problem, move similar defines to this header file Also clean all the header file mess in Evil Reviewers: cedric Subscribers: jpeg Differential Revision: https://phab.enlightenment.org/D3409
This commit is contained in:
parent
3e31eda3bd
commit
7782e2388c
|
@ -13,6 +13,7 @@ lib/evil/evil_langinfo.h \
|
|||
lib/evil/evil_locale.h \
|
||||
lib/evil/evil_macro.h \
|
||||
lib/evil/evil_macro_pop.h \
|
||||
lib/evil/evil_macro_wrapper.h \
|
||||
lib/evil/evil_main.h \
|
||||
lib/evil/evil_stdio.h \
|
||||
lib/evil/evil_stdlib.h \
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Evil.h>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Evil.h>
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <Evil.h>
|
||||
|
|
|
@ -100,13 +100,7 @@ extern "C" {
|
|||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <limits.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
#include <sys/stat.h> /* for mkdir in evil_macro_wrapper */
|
||||
|
||||
|
||||
typedef unsigned long uid_t;
|
||||
|
@ -125,7 +119,6 @@ typedef unsigned long gid_t;
|
|||
#include "evil_time.h"
|
||||
#include "evil_unistd.h"
|
||||
#include "evil_util.h"
|
||||
#include "evil_macro_pop.h"
|
||||
|
||||
#ifndef S_ISDIR
|
||||
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
|
||||
|
@ -173,18 +166,10 @@ typedef unsigned long gid_t;
|
|||
#define _S_IWUSR _S_IWRITE
|
||||
#define _S_IRUSR _S_IREAD
|
||||
|
||||
/*
|
||||
# define close(fd) _close(fd)
|
||||
# define read(fd,buffer,count) _read((fd),(buffer),(count))
|
||||
# define write(fd,buffer,count) _write((fd),(buffer),(count))
|
||||
# define unlink(filename) _unlink((filename))
|
||||
# define lstat(f,s) _stat((f),(s))
|
||||
*/
|
||||
|
||||
#define sigsetjmp(Env, Save) setjmp(Env)
|
||||
|
||||
#undef EAPI
|
||||
#define EAPI
|
||||
#include "evil_macro_wrapper.h"
|
||||
#include "evil_macro_pop.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
#include <psapi.h> /* EnumProcessModules(Ex) */
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_util.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#include "dlfcn.h"
|
||||
|
|
|
@ -2,10 +2,19 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <windows.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_stdio.h"
|
||||
|
||||
|
||||
struct DIR
|
||||
|
|
|
@ -6,8 +6,10 @@
|
|||
#include <sys/locking.h>
|
||||
|
||||
#include <winsock2.h> /* for ioctlsocket */
|
||||
#include <io.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_fcntl.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_inet.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#ifndef EMSGSIZE
|
||||
# define EMSGSIZE WSAEMSGSIZE
|
||||
|
|
|
@ -89,13 +89,6 @@
|
|||
*/
|
||||
EAPI int evil_inet_pton(int af, const char *src, void *dst);
|
||||
|
||||
/**
|
||||
* @def inet_pton(x,y,z)
|
||||
*
|
||||
* Wrapper around evil_inet_pton().
|
||||
*/
|
||||
#define inet_pton(x,y,z) evil_inet_pton(x,y,z)
|
||||
|
||||
/**
|
||||
* @brief Convert IPv4 and IPv6 addresses from binary to text form.
|
||||
*
|
||||
|
@ -136,13 +129,6 @@ EAPI int evil_inet_pton(int af, const char *src, void *dst);
|
|||
*/
|
||||
EAPI const char *evil_inet_ntop(int af, const char *src, void *dst, size_t size);
|
||||
|
||||
/**
|
||||
* @def inet_ntop(x,y,z,s)
|
||||
*
|
||||
* Wrapper around evil_inet_ntop().
|
||||
*/
|
||||
#define inet_ntop(x,y,z,s) evil_inet_ntop(x,y,z,s)
|
||||
|
||||
|
||||
#endif /* _WIN32_WINNT >= _WIN32_WINNT_VISTA */
|
||||
|
||||
|
|
|
@ -2,7 +2,11 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "Evil.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_langinfo.h"
|
||||
|
||||
|
||||
static char *
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_libgen.h"
|
||||
|
||||
char _evil_basename_buf[PATH_MAX];
|
||||
char _evil_dirname_buf[PATH_MAX];
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_locale.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
/*
|
||||
* LOCALE_SISO639LANGNAME and LOCALE_SISO3166CTRYNAME need at least a buffer
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* @def LC_MESSAGES
|
||||
*
|
||||
* New locale value, based on the one in libintl.h
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
#ifdef LC_MESSAGES
|
||||
# undef LC_MESSAGES
|
||||
|
@ -43,19 +45,11 @@
|
|||
* Conformity: Non applicable.
|
||||
*
|
||||
* Supported OS: Windows XP.
|
||||
*
|
||||
* @since 1.16
|
||||
*/
|
||||
EAPI char *evil_setlocale(int category, const char *locale);
|
||||
|
||||
/**
|
||||
* @def setlocale(cat, loc)
|
||||
*
|
||||
* Wrapper around evil_setlocale().
|
||||
*/
|
||||
#ifdef setlocale /* libintl.h defines setlocale() but always returns "C" */
|
||||
# undef setlocale
|
||||
#endif
|
||||
#define setlocale(cat, loc) evil_setlocale(cat, loc)
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -64,5 +64,8 @@
|
|||
#define SCNuPTR "llu"
|
||||
#endif /* _WIN64 */
|
||||
|
||||
#undef EAPI
|
||||
#define EAPI
|
||||
|
||||
|
||||
#endif /* __EVIL_MACRO_POP_H__ */
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
#ifndef __EVIL_MACRO_WRAPPER_H__
|
||||
#define __EVIL_MACRO_WRAPPER_H__
|
||||
|
||||
|
||||
/*
|
||||
* evil_inet.h
|
||||
*/
|
||||
|
||||
#if ! (_WIN32_WINNT >= 0x600 /* _WIN32_WINNT_VISTA */)
|
||||
|
||||
/**
|
||||
* @def inet_pton(x,y,z)
|
||||
*
|
||||
* Wrapper around evil_inet_pton().
|
||||
*/
|
||||
#define inet_pton(x,y,z) evil_inet_pton(x,y,z)
|
||||
|
||||
/**
|
||||
* @def inet_ntop(x,y,z,s)
|
||||
*
|
||||
* Wrapper around evil_inet_ntop().
|
||||
*/
|
||||
#define inet_ntop(x,y,z,s) evil_inet_ntop(x,y,z,s)
|
||||
|
||||
|
||||
#endif /* _WIN32_WINNT >= _WIN32_WINNT_VISTA */
|
||||
|
||||
/*
|
||||
* evil_locale.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def setlocale(cat, loc)
|
||||
*
|
||||
* Wrapper around evil_setlocale().
|
||||
* @since 1.16
|
||||
*/
|
||||
#ifdef setlocale /* libintl.h defines setlocale() but always returns "C" */
|
||||
# undef setlocale
|
||||
#endif
|
||||
#define setlocale(cat, loc) evil_setlocale(cat, loc)
|
||||
|
||||
/*
|
||||
* evil_stdio.h
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def rename(src, dest)
|
||||
*
|
||||
* Wrapper around evil_rename().
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
#ifdef rename
|
||||
# undef rename
|
||||
#endif
|
||||
#define rename(src, dst) evil_rename(src, dst)
|
||||
|
||||
/**
|
||||
* @def mkdir(dirname, mode)
|
||||
*
|
||||
* Wrapper around evil_mkdir().
|
||||
*
|
||||
* @since 1.15
|
||||
*/
|
||||
#ifdef mkdir
|
||||
# undef mkdir
|
||||
#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
|
||||
*/
|
||||
|
||||
/**
|
||||
* @def getcwd(b,s)
|
||||
*
|
||||
* Wrapper around evil_getcwd().
|
||||
*/
|
||||
#ifdef getcwd
|
||||
# undef getcwd
|
||||
#endif
|
||||
#define getcwd(b,s) evil_getcwd((b),(s))
|
||||
|
||||
/**
|
||||
* @def pipe(fds)
|
||||
*
|
||||
* Wrapper around evil_pipe().
|
||||
*/
|
||||
#ifdef pipe
|
||||
# undef pipe
|
||||
#endif
|
||||
#define pipe(fds) evil_pipe(fds)
|
||||
|
||||
|
||||
#endif
|
|
@ -2,13 +2,17 @@
|
|||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
# define WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
#include <winsock2.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_unistd.h"
|
||||
#include "evil_main.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
|
||||
|
@ -18,6 +22,8 @@ extern LONGLONG _evil_time_freq;
|
|||
extern LONGLONG _evil_time_count;
|
||||
extern long _evil_time_second;
|
||||
|
||||
long _evil_systemtime_to_time(SYSTEMTIME st);
|
||||
|
||||
int
|
||||
evil_init(void)
|
||||
{
|
||||
|
|
|
@ -14,12 +14,6 @@ extern "C" {
|
|||
# endif
|
||||
#endif
|
||||
|
||||
long _evil_systemtime_to_time(SYSTEMTIME st);
|
||||
|
||||
void _evil_error_display(const char *fct, LONG res);
|
||||
|
||||
void _evil_last_error_display(const char *fct);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,11 +2,13 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#define _POSIX
|
||||
#include <io.h>
|
||||
#include <lmcons.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "pwd.h"
|
||||
|
||||
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <direct.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_stdio.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
#undef rename
|
||||
|
|
|
@ -44,13 +44,6 @@
|
|||
*/
|
||||
EAPI int evil_rename(const char *src, const char *dst);
|
||||
|
||||
/**
|
||||
* @def rename(src, dest)
|
||||
*
|
||||
* Wrapper around evil_rename().
|
||||
*/
|
||||
#define rename(src, dst) evil_rename(src, dst)
|
||||
|
||||
/**
|
||||
* @brief Wrap the _mkdir() function on Windows.
|
||||
*
|
||||
|
@ -64,12 +57,5 @@ EAPI int evil_rename(const char *src, const char *dst);
|
|||
*/
|
||||
EAPI int evil_mkdir(const char *dirname, mode_t mode);
|
||||
|
||||
/**
|
||||
* @def mkdir(dirname, mode)
|
||||
*
|
||||
* Wrapper around evil_mkdir().
|
||||
*/
|
||||
#define mkdir(dirname, mode) evil_mkdir(dirname, mode)
|
||||
|
||||
|
||||
#endif /* __EVIL_STDIO_H__ */
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_stdlib.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
/*
|
||||
* Environment variable related functions
|
||||
|
|
|
@ -2,8 +2,12 @@
|
|||
# include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_string.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_time.h"
|
||||
#include "evil_macro_wrapper.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
struct tm *
|
||||
|
|
|
@ -34,16 +34,6 @@
|
|||
*/
|
||||
EAPI struct tm *evil_localtime_r(const time_t *timep, struct tm *result);
|
||||
|
||||
/**
|
||||
* @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)
|
||||
|
||||
/**
|
||||
* @brief Convert a string representation of time to a time tm structure .
|
||||
*
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <errno.h>
|
||||
#include <direct.h>
|
||||
# include <sys/time.h>
|
||||
|
||||
#ifndef WIN32_LEAN_AND_MEAN
|
||||
|
@ -11,8 +12,8 @@
|
|||
#include <winsock2.h>
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
|
||||
#include "Evil.h"
|
||||
#include "evil_private.h"
|
||||
#include "evil_macro.h"
|
||||
#include "evil_unistd.h"
|
||||
|
||||
|
||||
LONGLONG _evil_time_freq;
|
||||
|
@ -20,6 +21,8 @@ LONGLONG _evil_time_count;
|
|||
long _evil_time_second;
|
||||
|
||||
|
||||
long _evil_systemtime_to_time(SYSTEMTIME st);
|
||||
|
||||
long
|
||||
_evil_systemtime_to_time(SYSTEMTIME st)
|
||||
{
|
||||
|
|
|
@ -113,13 +113,6 @@ EAPI ssize_t readlink(const char *path, char *buf, size_t bufsiz);
|
|||
*/
|
||||
EAPI char *evil_getcwd(char *buffer, size_t size);
|
||||
|
||||
/**
|
||||
* @def getcwd(b,s)
|
||||
*
|
||||
* Wrapper around evil_getcwd().
|
||||
*/
|
||||
#define getcwd(b,s) evil_getcwd((b),(s))
|
||||
|
||||
/*
|
||||
* Sockets and pipe related functions
|
||||
*
|
||||
|
@ -166,13 +159,6 @@ EAPI void evil_sockets_shutdown(void);
|
|||
*/
|
||||
EAPI int evil_pipe(int *fds);
|
||||
|
||||
/**
|
||||
* @def pipe(fds)
|
||||
*
|
||||
* Wrapper around evil_pipe().
|
||||
*/
|
||||
#define pipe(fds) evil_pipe(fds)
|
||||
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
|
||||
#include "evil_macro.h"
|
||||
#include "evil_util.h"
|
||||
#include "evil_private.h"
|
||||
|
||||
|
||||
/* static void _evil_error_display(const char *fct, LONG res); */
|
||||
static void _evil_last_error_display(const char *fct);
|
||||
|
||||
wchar_t *
|
||||
evil_char_to_wchar(const char *text)
|
||||
{
|
||||
|
@ -159,15 +161,15 @@ evil_format_message(long err)
|
|||
return disp;
|
||||
}
|
||||
|
||||
void
|
||||
_evil_error_display(const char *fct, LONG res)
|
||||
{
|
||||
char *error;
|
||||
/* static void */
|
||||
/* _evil_error_display(const char *fct, LONG res) */
|
||||
/* { */
|
||||
/* char *error; */
|
||||
|
||||
error = evil_format_message(res);
|
||||
fprintf(stderr, "[Evil] [%s] ERROR (%ld): %s\n", fct, res, error);
|
||||
free(error);
|
||||
}
|
||||
/* error = evil_format_message(res); */
|
||||
/* fprintf(stderr, "[Evil] [%s] ERROR (%ld): %s\n", fct, res, error); */
|
||||
/* free(error); */
|
||||
/* } */
|
||||
|
||||
char *
|
||||
evil_last_error_get(void)
|
||||
|
@ -178,7 +180,7 @@ evil_last_error_get(void)
|
|||
return evil_format_message(err);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
_evil_last_error_display(const char *fct)
|
||||
{
|
||||
char *error;
|
||||
|
|
Loading…
Reference in New Issue