From: Erich Keane Date: Tue, 17 Mar 2015 21:05:51 +0000 (-0700) Subject: Removed Dead FormOCResponse Code X-Git-Tag: 0.9.1-alpha1~38^2~103 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f0c47de9f43ee6eba79c4ea2ab555e6b570919e;p=contrib%2Fiotivity.git Removed Dead FormOCResponse Code The function FormOCResponse was previously only used in one place, and had no side effects other than allocating memory and filling an object with a bunch of different values. The calling site (OCProcessPresence) only refers to the OCResponse object in this single call, then leaks it immediately after. This changeset removes the function, the variable, and the call to this function. Change-Id: Ic40440fce04343149528fb4d33f42f73da908171 Signed-off-by: Erich Keane Reviewed-on: https://gerrit.iotivity.org/gerrit/494 Tested-by: jenkins-iotivity Reviewed-by: Sachin Agrawal Reviewed-by: Sudarshan Prasad Reviewed-by: Sashi Penta --- diff --git a/resource/csdk/stack/src/ocstack.c b/resource/csdk/stack/src/ocstack.c index 47eafdd..f8fb72a 100644 --- a/resource/csdk/stack/src/ocstack.c +++ b/resource/csdk/stack/src/ocstack.c @@ -106,32 +106,6 @@ static uint32_t GetTime(float afterSeconds) return now + (uint32_t)(afterSeconds * COAP_TICKS_PER_SECOND); } -static OCStackResult FormOCResponse(OCResponse * * responseLoc, - ClientCB * cbNode, - uint32_t maxAge, - char * fullUri, - char * rcvdUri, - CAToken_t * rcvdToken, - OCClientResponse * clientResponse, - char * bufRes) -{ - OCResponse * response = (OCResponse *) OCMalloc(sizeof(OCResponse)); - if (!response) - { - return OC_STACK_NO_MEMORY; - } - response->cbNode = cbNode; - response->maxAge = maxAge; - response->fullUri = fullUri; - response->rcvdUri = rcvdUri; - response->rcvdToken = rcvdToken; - response->clientResponse = clientResponse; - response->bufRes = bufRes; - - *responseLoc = response; - return OC_STACK_OK; -} - /// This method is used to create the IPv4 dev_addr structure. /// TODO: Remove in future. Temporary helper function. /// Builds a socket interface address using IP address and port number @@ -1689,7 +1663,6 @@ OCStackResult OCProcessPresence() ClientCB* cbNode = NULL; OCDevAddr dst = {}; OCClientResponse clientResponse ={}; - OCResponse * response = NULL; OCStackApplicationResult cbResult = OC_STACK_DELETE_TRANSACTION; LL_FOREACH(cbList, cbNode) @@ -1728,13 +1701,6 @@ OCStackResult OCProcessPresence() clientResponse.addr = (OCDevAddr *) &dst; clientResponse.resJSONPayload = NULL; - result = FormOCResponse(&response, cbNode, 0, NULL, NULL, - &cbNode->token, &clientResponse, NULL); - if(result != OC_STACK_OK) - { - goto exit; - } - // Increment the TTLLevel (going to a next state), so we don't keep // sending presence notification to client. cbNode->presence->TTLlevel++;