Move macro from consumer common to NSConstant.h
authorjaesick.shin <jaesick.shin@samsung.com>
Mon, 1 Aug 2016 06:03:56 +0000 (15:03 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Wed, 3 Aug 2016 13:52:32 +0000 (13:52 +0000)
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 <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9883
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/src/common/NSConstants.h
service/notification/src/consumer/NSConsumerCommon.h

index e532115..c263fba 100644 (file)
 #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,
index e01c000..841612f 100644 (file)
@@ -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.