X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=fhi_lib%2Flib%2Fsrc%2Fxran_printf.h;h=e2c938b067454ee7e8a8b49e1b19cb5258013e9e;hb=2de97529a4c5a1922214ba0e6f0fb84cacbd0bc7;hp=6caee87631c1d49c2215803e80d90f4eec9f49b9;hpb=4745e5c88ba931c6d71cb6d8c681f76cf364eac5;p=o-du%2Fphy.git diff --git a/fhi_lib/lib/src/xran_printf.h b/fhi_lib/lib/src/xran_printf.h index 6caee87..e2c938b 100644 --- a/fhi_lib/lib/src/xran_printf.h +++ b/fhi_lib/lib/src/xran_printf.h @@ -1,6 +1,6 @@ /****************************************************************************** * -* Copyright (c) 2019 Intel. +* Copyright (c) 2020 Intel. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ * *******************************************************************************/ - /** * @brief Modules provide debug prints and utility functions * @file xran_printf.h @@ -30,6 +29,7 @@ #ifdef __cplusplus extern "C" { #endif + #include #include @@ -40,32 +40,32 @@ extern "C" { #ifndef WIN32 #ifdef PRINTF_LOG_OK -#define print_log(fmt, args...) printf("%s:" fmt "\n", __FUNCTION__, ## args) +#define print_log(fmt, args...) printf("%s:%d" fmt "\n", __FUNCTION__, __LINE__, ## args) #else /* PRINTF_LOG_OK */ #define print_log(fmt, args...) #endif /* PRINTF_LOG_OK */ #else -#define print_log(fmt, ...) printf("%s:" fmt "\n", __FUNCTION__, __VA_ARGS__) +#define print_log(fmt, ...) printf("%s:%d" fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) #endif #ifndef WIN32 #ifdef PRINTF_DBG_OK -#define print_dbg(fmt, args...) printf("%s:[dbg] " fmt "\n", __FUNCTION__, ## args) +#define print_dbg(fmt, args...) printf("%s:%d[dbg] " fmt "\n", __FUNCTION__, __LINE__, ## args) #else /* PRINTF_LOG_OK */ #define print_dbg(fmt, args...) #endif /* PRINTF_LOG_OK */ #else -#define print_dbg(fmt, ...) printf("%s:[dbg] " fmt "\n", __FUNCTION__, __VA_ARGS__) +#define print_dbg(fmt, ...) printf("%s:%d[dbg] " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) #endif #ifndef WIN32 #ifdef PRINTF_ERR_OK -#define print_err(fmt, args...) printf("%s:[err] " fmt "\n", __FUNCTION__, ## args) +#define print_err(fmt, args...) printf("%s:%d[err] " fmt "\n", __FUNCTION__, __LINE__, ## args) #else /* PRINTF_LOG_OK */ #define print_err(fmt, args...) #endif /* PRINTF_LOG_OK */ #else -#define print_err(fmt, ...) printf("%s:[err] " fmt "\n", __FUNCTION__, __VA_ARGS__) +#define print_err(fmt, ...) printf("%s:%d[err] " fmt "\n", __FUNCTION__, __LINE__, __VA_ARGS__) #endif #ifndef WIN32 @@ -101,7 +101,16 @@ extern "C" { #endif /* _IASSERT_*/ - +#ifdef CHECK_PARAMS +#define CHECK_NOT_NULL(param, returnValue) \ +if (param == NULL) \ +{ \ + print_err("%s is NULL!\n", #param); \ + return returnValue; \ +} +#else +#define CHECK_NOT_NULL(param, returnValue) +#endif #ifdef __cplusplus }