From 646b1d619d835a8efc9c99a885e256a321950d8b Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Mon, 1 Aug 2016 15:03:56 +0900 Subject: [PATCH] Move macro from consumer common to NSConstant.h Move the location of "Macro function" from NCConsumerCommon.h to NSConstants.h. Because, provider will use the macros also. Change-Id: I00b6fcba65ae491eb2a5457ddcf80f6c42df6cde Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/9883 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- service/notification/src/common/NSConstants.h | 82 ++++++++++++++++++++++ .../notification/src/consumer/NSConsumerCommon.h | 81 --------------------- 2 files changed, 82 insertions(+), 81 deletions(-) diff --git a/service/notification/src/common/NSConstants.h b/service/notification/src/common/NSConstants.h index e532115..c263fba 100644 --- a/service/notification/src/common/NSConstants.h +++ b/service/notification/src/common/NSConstants.h @@ -87,6 +87,88 @@ #define NS_POLICY_PROVIDER 1 #define NS_POLICY_CONSUMER 0 +#define NS_VERIFY_NOT_NULL_V(obj) \ + { \ + if ((obj) == NULL) \ + { \ + NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ + return; \ + } \ + } + +#define NS_VERIFY_NOT_NULL(obj, retVal) \ + { \ + if ((obj) == NULL) \ + { \ + NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ + return (retVal); \ + } \ + } + +#define NS_VERIFY_NOT_NULL_WITH_POST_CLEANING_V(obj, func) \ + { \ + if ((obj) == NULL) \ + { \ + NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ + NS_LOG(ERROR, "execute deletion"); \ + (func); \ + return; \ + } \ + } + +#define NS_VERIFY_NOT_NULL_WITH_POST_CLEANING(obj, retVal, func) \ + { \ + if ((obj) == NULL) \ + { \ + NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ + NS_LOG(ERROR, "execute deletion"); \ + (func); \ + return (retVal); \ + } \ + } + +#define NS_VERIFY_STACK_SUCCESS_V(obj) \ + { \ + bool _ret = (obj); \ + if ( _ret != true) \ + { \ + NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ + return; \ + } \ + } + +#define NS_VERIFY_STACK_SUCCESS(obj, retVal) \ + { \ + bool _ret = (obj); \ + if ( _ret != true) \ + { \ + NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ + return (retVal); \ + } \ + } + +#define NS_VERIFY_STACK_SUCCESS_WITH_POST_CLEANING(obj, retVal, func) \ + { \ + bool _ret = (obj); \ + if ( _ret != true) \ + { \ + NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ + (func); \ + return (retVal); \ + } \ + } + +#define NSOICFree(obj) \ + { \ + if ((obj)) \ + { \ + OICFree((obj)); \ + (obj) = NULL; \ + NS_LOG_V(DEBUG, "%s : %s Removed", __func__, #obj); \ + } \ + } + + typedef enum eConnectionState { DISCONNECTED = 0, diff --git a/service/notification/src/consumer/NSConsumerCommon.h b/service/notification/src/consumer/NSConsumerCommon.h index e01c000..841612f 100644 --- a/service/notification/src/consumer/NSConsumerCommon.h +++ b/service/notification/src/consumer/NSConsumerCommon.h @@ -42,87 +42,6 @@ extern "C" { #define NS_DISCOVER_QUERY "/oic/res?rt=oic.r.notification" #define NS_DEVICE_ID_LENGTH 37 -#define NS_VERIFY_NOT_NULL_V(obj) \ - { \ - if ((obj) == NULL) \ - { \ - NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ - return; \ - } \ - } - -#define NS_VERIFY_NOT_NULL(obj, retVal) \ - { \ - if ((obj) == NULL) \ - { \ - NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ - return (retVal); \ - } \ - } - -#define NS_VERIFY_NOT_NULL_WITH_POST_CLEANING_V(obj, func) \ - { \ - if ((obj) == NULL) \ - { \ - NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ - NS_LOG(ERROR, "execute deletion"); \ - (func); \ - return; \ - } \ - } - -#define NS_VERIFY_NOT_NULL_WITH_POST_CLEANING(obj, retVal, func) \ - { \ - if ((obj) == NULL) \ - { \ - NS_LOG_V(ERROR, "%s : %s is null", __func__, #obj); \ - NS_LOG(ERROR, "execute deletion"); \ - (func); \ - return (retVal); \ - } \ - } - -#define NS_VERIFY_STACK_SUCCESS_V(obj) \ - { \ - bool _ret = (obj); \ - if ( _ret != true) \ - { \ - NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ - return; \ - } \ - } - -#define NS_VERIFY_STACK_SUCCESS(obj, retVal) \ - { \ - bool _ret = (obj); \ - if ( _ret != true) \ - { \ - NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ - return (retVal); \ - } \ - } - -#define NS_VERIFY_STACK_SUCCESS_WITH_POST_CLEANING(obj, retVal, func) \ - { \ - bool _ret = (obj); \ - if ( _ret != true) \ - { \ - NS_LOG_V(ERROR, "%s : %s is not OC_STACK_OK : %d", __func__, #obj, _ret); \ - (func); \ - return (retVal); \ - } \ - } - -#define NSOICFree(obj) \ - { \ - if ((obj)) \ - { \ - OICFree((obj)); \ - (obj) = NULL; \ - NS_LOG_V(DEBUG, "%s : %s Removed", __func__, #obj); \ - } \ - } - typedef enum { NS_DISCOVER_DEFAULT, // will work for adapter_ip. -- 2.7.4