#endif
/**
- * @def VERIFY_NON_NULL
+ * @def VERIFY_NON_NULL_RET
* @brief Macro to verify the validity of input argument
*/
-#define VERIFY_NON_NULL(arg, log_tag, log_message) \
- if (NULL == arg ){ \
+#define VERIFY_NON_NULL_RET(arg, log_tag, log_message,ret) \
+ if (NULL == arg) { \
OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
- return CA_STATUS_INVALID_PARAM; \
+ return ret; \
} \
/**
- * @def VERIFY_NON_NULL_RET
+ * @def VERIFY_NON_NULL
* @brief Macro to verify the validity of input argument
*/
-#define VERIFY_NON_NULL_RET(arg, log_tag, log_message,ret) \
- if (NULL == arg ){ \
- OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
- return ret; \
- } \
+#define VERIFY_NON_NULL(arg, log_tag, log_message) \
+ VERIFY_NON_NULL_RET((arg), (log_tag), (log_message), CA_STATUS_INVALID_PARAM)
/**
* @def VERIFY_NON_NULL_VOID
* @brief Macro to verify the validity of input argument
*/
#define VERIFY_NON_NULL_VOID(arg, log_tag, log_message) \
- if (NULL == arg ){ \
+ if (NULL == arg) { \
OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
return; \
} \
#include "cacommon.h"
#include "coap.h"
-/**
- * @def VERIFY_NON_NULL
- * @brief Macro to verify the validity of input argument.
- */
-#define VERIFY_NON_NULL(arg, log_tag, log_message) \
- if (NULL == arg ){ \
- OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
- return CA_STATUS_INVALID_PARAM; \
- } \
-
-/**
- * @def VERIFY_NON_NULL_VOID
- * @brief Macro to verify the validity of input argument.
- */
-#define VERIFY_NON_NULL_VOID(arg, log_tag, log_message) \
- if (NULL == arg ){ \
- OIC_LOG_V(ERROR, log_tag, "Invalid input:%s", log_message); \
- return; \
- } \
-
#define CA_MEMORY_ALLOC_CHECK(arg) { if (NULL == arg) {OIC_LOG(ERROR, TAG, "Out of memory"); \
goto memory_error_exit;} }