From a8ad9b2c2202732bbf9497cfc2259df49b4a088b Mon Sep 17 00:00:00 2001 From: Sakthivel Samidurai Date: Mon, 23 Mar 2015 14:00:11 -0700 Subject: [PATCH] Clean up OCStop in C stack Cleanup OCStop method in the C stack. Remove unnecessary error check. Change-Id: I4a1618c684c685a32f70b3087f08fca0961d3461 Signed-off-by: Sakthivel Samidurai Reviewed-on: https://gerrit.iotivity.org/gerrit/545 Reviewed-by: Sachin Agrawal Tested-by: jenkins-iotivity Reviewed-by: Erich Keane --- resource/csdk/stack/src/ocstack.c | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index c859a15..1c8630f 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -1150,8 +1150,6 @@ exit: */ OCStackResult OCStop() { - OCStackResult result = OC_STACK_ERROR; - OC_LOG(INFO, TAG, PCF("Entering OCStop")); if (stackState == OC_STACK_UNINIT_IN_PROGRESS) @@ -1177,30 +1175,14 @@ OCStackResult OCStop() deleteAllResources(); DeleteDeviceInfo(); CATerminate(); - //CATerminate does not return any error code. It is OK to assign result to OC_STACK_OK. - result = OC_STACK_OK; - - if (result == OC_STACK_OK) - { - // Remove all observers - DeleteObserverList(); - // Remove all the client callbacks - DeleteClientCBList(); - stackState = OC_STACK_UNINITIALIZED; - result = OC_STACK_OK; - } else { - stackState = OC_STACK_INITIALIZED; - result = OC_STACK_ERROR; - } - + // Remove all observers + DeleteObserverList(); + // Remove all the client callbacks + DeleteClientCBList(); // Deinit security blob DeinitOCSecurityInfo(); - - if (result != OC_STACK_OK) { - OC_LOG(ERROR, TAG, PCF("Stack stop error")); - } - - return result; + stackState = OC_STACK_UNINITIALIZED; + return OC_STACK_OK; } /** -- 2.7.4