1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- #ifndef UA_UTIL_H_
- #define UA_UTIL_H_
- #include "ua_config.h"
- /* Subtract from nodeids to get from the encoding to the content */
- #define UA_ENCODINGOFFSET_XML 1
- #define UA_ENCODINGOFFSET_BINARY 2
- #include <assert.h> // assert
- #define UA_assert(ignore) assert(ignore)
- /*********************/
- /* Memory Management */
- /*********************/
- /* Replace the macros with functions for custom allocators if necessary */
- #include <stdlib.h> // malloc, free
- #ifdef _WIN32
- # include <malloc.h>
- #endif
- #ifndef UA_free
- # define UA_free(ptr) free(ptr)
- #endif
- #ifndef UA_malloc
- # define UA_malloc(size) malloc(size)
- #endif
- #ifndef UA_calloc
- # define UA_calloc(num, size) calloc(num, size)
- #endif
- #ifndef UA_realloc
- # define UA_realloc(ptr, size) realloc(ptr, size)
- #endif
- #ifndef NO_ALLOCA
- # ifdef __GNUC__
- # define UA_alloca(size) __builtin_alloca (size)
- # elif defined(_WIN32)
- # define UA_alloca(SIZE) _alloca(SIZE)
- # else
- # include <alloca.h>
- # define UA_alloca(SIZE) alloca(SIZE)
- # endif
- #endif
- /************************/
- /* Thread Local Storage */
- /************************/
- #ifdef UA_MULTITHREADING
- # ifdef __GNUC__
- # define UA_THREAD_LOCAL __thread
- # elif defined(_MSC_VER)
- # define UA_THREAD_LOCAL __declspec(thread)
- # else
- # error No thread local storage keyword defined for this compiler
- # endif
- #else
- # define UA_THREAD_LOCAL
- #endif
- /********************/
- /* System Libraries */
- /********************/
- #include <time.h>
- #ifdef _WIN32
- # include <winsock2.h> //needed for amalgation
- # include <windows.h>
- # undef SLIST_ENTRY
- #else
- # include <sys/time.h>
- #endif
- /*************************/
- /* External Dependencies */
- /*************************/
- #include "queue.h"
- #ifdef UA_MULTITHREADING
- # define _LGPL_SOURCE
- # include <urcu.h>
- # include <urcu/wfcqueue.h>
- # include <urcu/uatomic.h>
- # include <urcu/rculfhash.h>
- #include <urcu/lfstack.h>
- #endif
- #endif /* UA_UTIL_H_ */
|