1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00

Replace inline with LWS_INLINE

Use a new macro instead of defining inline to avoid namespace pollution
in the embedding application.
This commit is contained in:
Patrick Gansterer 2014-02-28 15:15:21 +01:00
parent af93a71a90
commit 536d44bba1
6 changed files with 14 additions and 30 deletions

View file

@ -115,27 +115,6 @@ endif()
include_directories("${PROJECT_BINARY_DIR}")
include(CheckCSourceCompiles)
# Check for different inline keyword versions.
foreach(KEYWORD "inline" "__inline__" "__inline")
set(CMAKE_REQUIRED_DEFINITIONS "-DKEYWORD=${KEYWORD}")
CHECK_C_SOURCE_COMPILES(
"
#include <stdio.h>
KEYWORD void a() {}
int main(int argc, char **argv) { a(); return 0; }
" HAVE_${KEYWORD})
endforeach()
if (NOT HAVE_inline)
if (HAVE___inline__)
set(inline __inline__)
elseif(HAVE___inline)
set(inline __inline)
endif()
endif()
# Put the libaries and binaries that get built into directories at the
# top of the build tree rather than in hard-to-find leaf directories.
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")

View file

@ -154,6 +154,3 @@
/* Define as `fork' if `vfork' does not work. */
//#cmakedefine vfork
/* Define if the inline keyword doesn't exist. */
#cmakedefine inline

View file

@ -144,7 +144,7 @@ static unsigned long long time_in_microseconds()
}
#ifdef _WIN32_WCE
static inline time_t time(time_t *t)
static LWS_INLINE time_t time(time_t *t)
{
time_t ret = time_in_microseconds() / 1000000;
*t = ret;

View file

@ -86,10 +86,18 @@ typedef SSIZE_T ssize_t;
#include <assert.h>
#if !defined(__cplusplus) && defined(_MSC_VER)
#define LWS_INLINE __inline
#endif
#ifndef LWS_EXTERN
#define LWS_EXTERN extern
#endif
#ifndef LWS_INLINE
#define LWS_INLINE inline
#endif
#define CONTEXT_PORT_NO_LISTEN 0
#define MAX_MUX_RECURSION 2
@ -1034,7 +1042,7 @@ libwebsocket_write(struct libwebsocket *wsi, unsigned char *buf, size_t len,
enum libwebsocket_write_protocol protocol);
/* helper for case where buffer may be const */
static inline int
static LWS_INLINE int
libwebsocket_write_http(struct libwebsocket *wsi,
const unsigned char *buf, size_t len)
{

View file

@ -461,10 +461,10 @@ libwebsocket_close_and_free_session(struct libwebsocket_context *context,
struct libwebsocket *wsi, enum lws_close_status);
#ifndef LWS_LATENCY
static inline void lws_latency(struct libwebsocket_context *context,
static LWS_INLINE void lws_latency(struct libwebsocket_context *context,
struct libwebsocket *wsi, const char *action,
int ret, int completion) { while (0); }
static inline void lws_latency_pre(struct libwebsocket_context *context,
static LWS_INLINE void lws_latency_pre(struct libwebsocket_context *context,
struct libwebsocket *wsi) { while (0); }
#else
#define lws_latency_pre(_context, _wsi) lws_latency(_context, _wsi, NULL, 0, 0)

View file

@ -485,7 +485,7 @@ LWS_VISIBLE int libwebsockets_return_http_status(
}
#if defined(WIN32) || defined(_WIN32)
static inline HANDLE lws_open_file(const char* filename, unsigned long* filelen)
static LWS_INLINE HANDLE lws_open_file(const char* filename, unsigned long* filelen)
{
HANDLE ret;
WCHAR buffer[MAX_PATH];
@ -501,7 +501,7 @@ static inline HANDLE lws_open_file(const char* filename, unsigned long* filelen)
return ret;
}
#else
static inline int lws_open_file(const char* filename, unsigned long* filelen)
static LWS_INLINE int lws_open_file(const char* filename, unsigned long* filelen)
{
struct stat stat_buf;
int ret = open(filename, O_RDONLY);