#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 #define UA_assert(ignore) assert(ignore) /*********************/ /* Memory Management */ /*********************/ /* Replace the macros with functions for custom allocators if necessary */ #include // malloc, free #ifdef _WIN32 # include #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 # 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 #ifdef _WIN32 # include //needed for amalgation # include # undef SLIST_ENTRY #else # include #endif /*************************/ /* External Dependencies */ /*************************/ #include "queue.h" #ifdef UA_MULTITHREADING # define _LGPL_SOURCE # include # include # include # include #include #endif #endif /* UA_UTIL_H_ */