Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions src/lib/evil/evil_api.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
#ifndef EVIL_API_H
#define EVIL_API_H

#ifdef EAPI
#undef EAPI
#ifdef EVIL_API
#error EVIL_API should not be already defined
#endif
Comment on lines +4 to 6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're using evil_api.h, there's no reason to check this at all actually, since the include-guards will handle it.


#ifdef _WIN32
# ifdef EFL_BUILD
# ifdef DLL_EXPORT
# define EAPI __declspec(dllexport)
# ifndef EVIL_STATIC
# ifdef EVIL_BUILD
# define EVIL_API __declspec(dllexport)
# else
# define EAPI
# define EVIL_API __declspec(dllimport)
# endif
# else
# define EAPI __declspec(dllimport)
# define EVIL_API
# endif
# define EVIL_API_WEAK
#else
# if __GNUC__ >= 4
# define EAPI __attribute__ ((visibility("default")))
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EVIL_API __attribute__ ((visibility("default")))
# define EVIL_API_WEAK __attribute__ ((weak))
# else
# define EVIL_API
# define EVIL_API_WEAK
# endif
# else
# define EAPI
/**
* @def EVIL_API
* @brief Used to export functions (by changing visibility).
*/
# define EVIL_API
/**
* @def EINA_API_WEAK
* @brief Weak symbol, primarily useful in defining library functions which
* can be overridden in user code.
* Note: Not supported on all platforms.
*/
# define EINA_API_WEAK
# endif
#endif

#endif
#endif // EVIL_API_H
2 changes: 1 addition & 1 deletion src/lib/evil/evil_basename.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <evil_windows.h>

EAPI char* basename (char* path)
EVIL_API char* basename (char* path)
{
static char base[MAX_PATH];
_splitpath_s (path, NULL, 0, NULL, 0, base, MAX_PATH, NULL, 0);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/evil/evil_basename.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <evil_api.h>

EAPI char* basename (char* path);
EVIL_API char* basename (char* path);

#endif

10 changes: 5 additions & 5 deletions src/lib/evil/evil_dlfcn.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ _dl_get_last_error(char *desc)
_dl_err_viewed = 0;
}

void *
EVIL_API void *
dlopen(const char* path, int mode EVIL_UNUSED)
{
HMODULE module = NULL;
Expand Down Expand Up @@ -95,7 +95,7 @@ dlopen(const char* path, int mode EVIL_UNUSED)
return module;
}

int
EVIL_API int
dlclose(void* handle)
{
if (FreeLibrary(handle))
Expand All @@ -107,7 +107,7 @@ dlclose(void* handle)
}
}

void *
EVIL_API void *
dlsym(void *handle, const char *symbol)
{
FARPROC fp = NULL;
Expand Down Expand Up @@ -157,7 +157,7 @@ dlsym(void *handle, const char *symbol)
return fp;
}

char *
EVIL_API char *
dlerror (void)
{
if (!_dl_err_viewed)
Expand All @@ -184,7 +184,7 @@ _dladdr_comp(const void *p1, const void *p2)
return ( *(int *)p1 - *(int *)p2);
}

int
EVIL_API int
dladdr (const void *addr, Dl_info *info)
{
TCHAR tpath[PATH_MAX];
Expand Down
10 changes: 5 additions & 5 deletions src/lib/evil/evil_dlfcn.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ struct Dl_info
*
* @ingroup Evil_Dlfcn
*/
EAPI void *dlopen(const char* path, int mode);
EVIL_API void *dlopen(const char* path, int mode);

#ifndef HAVE_DLOPEN
# define HAVE_DLOPEN 1
Expand All @@ -170,7 +170,7 @@ EAPI void *dlopen(const char* path, int mode);
*
* @ingroup Evil_Dlfcn
*/
EAPI int dlclose(void* handle);
EVIL_API int dlclose(void* handle);

/**
* @brief Get the address of a symbol.
Expand All @@ -194,7 +194,7 @@ EAPI int dlclose(void* handle);
*
* @ingroup Evil_Dlfcn
*/
EAPI void *dlsym(void* handle, const char* symbol);
EVIL_API void *dlsym(void* handle, const char* symbol);

#ifndef HAVE_DLSYM
#define HAVE_DLSYM 1
Expand Down Expand Up @@ -224,7 +224,7 @@ EAPI void *dlsym(void* handle, const char* symbol);
*
* @ingroup Evil_Dlfcn
*/
EAPI int dladdr(const void *addr, Dl_info *info);
EVIL_API int dladdr(const void *addr, Dl_info *info);

#ifndef HAVE_DLADDR
#define HAVE_DLADDR 1
Expand Down Expand Up @@ -252,7 +252,7 @@ EAPI int dladdr(const void *addr, Dl_info *info);
*
* @ingroup Evil_Dlfcn
*/
EAPI char *dlerror(void);
EVIL_API char *dlerror(void);


#endif /* __EVIL_DLFCN_H__ */
3 changes: 2 additions & 1 deletion src/lib/evil/evil_fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ _is_socket(SOCKET s)
*
*/

int fcntl(int fd, int cmd, ...)
EVIL_API int
fcntl(int fd, int cmd, ...)
{
va_list va;
int res = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/evil/evil_fcntl.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct flock
*
* @ingroup Evil
*/
EAPI int fcntl(int fd, int cmd, ...);
EVIL_API int fcntl(int fd, int cmd, ...);


#endif /* __EVIL_FCNTL_H__ */
2 changes: 1 addition & 1 deletion src/lib/evil/evil_langinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ replace(char *prev, char *value)
return strdup (value);
}

char *
EVIL_API char *
nl_langinfo(nl_item index)
{
static char *result = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/evil/evil_langinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ enum {
# define CODESET _NL_CTYPE_CODESET
# define RADIXCHAR _NL_NUMERIC_RADIXCHAR

EAPI char *nl_langinfo(nl_item index);
EVIL_API char *nl_langinfo(nl_item index);


#endif /*__EVIL_LANGINFO_H__ */
3 changes: 2 additions & 1 deletion src/lib/evil/evil_locale.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ static char _evil_locale_buf[18];

#undef setlocale

char *evil_setlocale(int category, const char *locale)
EVIL_API char *
evil_setlocale(int category, const char *locale)
{
char buf[9];
int l1;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/evil/evil_locale.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
*
* @since 1.16
*/
EAPI char *evil_setlocale(int category, const char *locale);
EVIL_API char *evil_setlocale(int category, const char *locale);


/**
Expand Down
4 changes: 2 additions & 2 deletions src/lib/evil/evil_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
* When Evil is not used anymore, call evil_shutdown() to shut down
* the Evil library.
*/
EAPI int evil_init(void);
EVIL_API int evil_init(void);

/**
* @brief Shut down the Evil library.
Expand All @@ -118,7 +118,7 @@ EAPI int evil_init(void);
* documentation anymore . You must call evil_init() again to use these
* functions again.
*/
EAPI int evil_shutdown(void);
EVIL_API int evil_shutdown(void);


/**
Expand Down
6 changes: 3 additions & 3 deletions src/lib/evil/evil_mman.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _evil_mmap_protection_get(int prot)
/***** API *****/


void *
EVIL_API void *
mmap(void *addr EVIL_UNUSED,
size_t len,
int prot,
Expand Down Expand Up @@ -138,7 +138,7 @@ mmap(void *addr EVIL_UNUSED,
return data;
}

int
EVIL_API int
munmap(void *addr,
size_t len EVIL_UNUSED)
{
Expand All @@ -152,7 +152,7 @@ munmap(void *addr,
return (res == 0) ? -1 : 0;
}

int
EVIL_API int
mprotect(void *addr, size_t len, int prot)
{
DWORD old;
Expand Down
6 changes: 3 additions & 3 deletions src/lib/evil/evil_mman.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
*
* @ingroup Evil_Mman
*/
EAPI void *mmap(void *addr,
EVIL_API void *mmap(void *addr,
size_t len,
int prot,
int flags,
Expand Down Expand Up @@ -140,7 +140,7 @@ EAPI void *mmap(void *addr,
*
* @ingroup Evil_Mman
*/
EAPI int munmap(void *addr,
EVIL_API int munmap(void *addr,
size_t len);

/**
Expand All @@ -161,7 +161,7 @@ EAPI int munmap(void *addr,
*
* @ingroup Evil_Mman
*/
EAPI int mprotect(void *addr, size_t len, int prot);
EVIL_API int mprotect(void *addr, size_t len, int prot);


#endif /* __EVIL_SYS_MMAN_H__ */
Expand Down
4 changes: 2 additions & 2 deletions src/lib/evil/evil_stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#undef rename

int
EVIL_API int
evil_rename(const char *src, const char* dst)
{
DWORD res;
Expand All @@ -23,7 +23,7 @@ evil_rename(const char *src, const char* dst)
return MoveFileEx(src, dst, MOVEFILE_REPLACE_EXISTING) ? 0 : -1;
}

int
EVIL_API int
evil_mkdir(const char *dirname, mode_t mode EVIL_UNUSED)
{
return _mkdir(dirname);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/evil/evil_stdio.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ typedef int mode_t;
*
* @since 1.8
*/
EAPI int evil_rename(const char *src, const char *dst);
EVIL_API int evil_rename(const char *src, const char *dst);

/**
* @brief Wrap the _mkdir() function on Windows.
Expand All @@ -60,7 +60,7 @@ EAPI int evil_rename(const char *src, const char *dst);
*
* @since 1.15
*/
EAPI int evil_mkdir(const char *dirname, mode_t mode);
EVIL_API int evil_mkdir(const char *dirname, mode_t mode);

/**
* @}
Expand Down
10 changes: 5 additions & 5 deletions src/lib/evil/evil_stdlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/

int
EVIL_API int
setenv(const char *name,
const char *value,
int overwrite)
Expand Down Expand Up @@ -65,7 +65,7 @@ setenv(const char *name,
return res;
}

int
EVIL_API int
unsetenv(const char *name)
{
return setenv(name, NULL, 1);
Expand Down Expand Up @@ -119,7 +119,7 @@ _mkstemp(char *suffix, int val)
return val;
}

EAPI char *
EVIL_API char *
mkdtemp(char *__template)
{
char *suffix;
Expand Down Expand Up @@ -157,7 +157,7 @@ mkdtemp(char *__template)
return NULL;
}

int
EVIL_API int
mkstemps(char *__template, int suffixlen)
{
char *suffix;
Expand Down Expand Up @@ -186,7 +186,7 @@ mkstemps(char *__template, int suffixlen)
return -1;
}

char *
EVIL_API char *
realpath(const char *file_name, char *resolved_name)
{
char *retname = NULL; /* we will return this, if we fail */
Expand Down
Loading