#endif
#define assert(exp) \
- do { \
- if (!(exp)) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert Fail; Following expression is not true: %s\n", \
- __FILE__, __LINE__, #exp); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (!(exp)) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert Fail; Following expression is not true: %s\n", \
+ __FILE__, __LINE__, #exp); \
+ return 1; \
+ } \
+ } while (0)
#define assert_eq(var, ref) \
- do { \
- if (var != ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var != ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#define assert_eq_no_return(var, ref) \
- do { \
- if (var != ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return ; \
- } \
- } while (0)
+ do { \
+ if (var != ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are not equal\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return ; \
+ } \
+ } while (0)
#define assert_neq_no_return(var, ref) \
- do { \
- if (var == ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are equal\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return ; \
- } \
- } while (0)
+ do { \
+ if (var == ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are equal\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return ; \
+ } \
+ } while (0)
#define assert_neq(var, ref) \
- do { \
- if (var == ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are equal\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var == ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) and (%s == 0x%x) are equal\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#define assert_gt(var, ref) \
- do { \
- if (var <= ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not greater than (%s == 0x%x)\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var <= ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not greater than (%s == 0x%x)\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#define assert_geq(var, ref) \
- do { \
- if (var < ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not greater than or equal to (%s == 0x%x)\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var < ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not greater than or equal to (%s == 0x%x)\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#define assert_lt(var, ref) \
- do { \
- if (var >= ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not lower than (%s == 0x%x)\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var >= ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not lower than (%s == 0x%x)\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#define assert_leq(var, ref) \
- do { \
- if (var > ref) { \
- fprintf(stderr, \
- "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not lower than or equal to (%s == 0x%x)\n", \
- __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
- return 1; \
- } \
- } while (0)
+ do { \
+ if (var > ref) { \
+ fprintf(stderr, \
+ "\n[TCT][%s][Line : %d] Assert fail; Values (%s == 0x%x) is not lower than or equal to (%s == 0x%x)\n", \
+ __FILE__, __LINE__, #var, (int)var, #ref, (int)ref); \
+ return 1; \
+ } \
+ } while (0)
#ifdef __cplusplus
}
g_nTimeoutId = g_timeout_add(GMAINTIMEOUT, ua_callback_timeout, g_pMainLoop);\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Run mainloop [%p]",\
- __LINE__, __FUNCTION__, g_pMainLoop);\
- }\
+ __LINE__, __FUNCTION__, g_pMainLoop);\
+ } \
g_main_loop_run(g_pMainLoop);\
g_source_remove(g_nTimeoutId);\
g_pMainLoop = NULL;\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] Quit mainloop [%p]",\
__LINE__, __FUNCTION__, g_pMainLoop);\
- }\
+ } \
g_main_loop_quit(g_pMainLoop);\
}
#define FREE_MEMORY(var) {\
- if(var != NULL) {\
+ if (var != NULL) {\
g_free(var);\
var = NULL;\
- }\
+ } \
}
#define PRINT_RETURN(api, ret) {\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s returned = %s",\
__LINE__, __FUNCTION__, api, ua_error_to_string(ret));\
- }\
+ } \
}
#define CHECK_INIT_RETURN(var) {\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] UA is not initialized",\
__LINE__, __FUNCTION__);\
- }\
+ } \
return 1;\
- }\
+ } \
}
#define CHECK_RETURN(api, ret, val) {\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s failed, error returned = %s",\
__LINE__, __FUNCTION__, api, ua_error_to_string(ret));\
- }\
+ } \
return 1;\
} else {\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] %s",\
__LINE__, __FUNCTION__, api);\
- }\
- }\
+ } \
+ } \
}
#define DEBUG_LOG(str) {\
if (COMMON_DEBUG) {\
PRINT_LOG(DLOG_INFO, "NativeTCT", "[Line:%5d][%s] ***** DEBUG [%s] *****",\
__LINE__, __FUNCTION__, str);\
- }\
+ } \
}
gboolean ua_callback_timeout(gpointer data);