Simplify copying of CAInfo_t
authorThiago Macieira <thiago.macieira@intel.com>
Tue, 12 May 2015 07:19:17 +0000 (16:19 +0900)
committerErich Keane <erich.keane@intel.com>
Wed, 13 May 2015 16:50:45 +0000 (16:50 +0000)
This copies all members, which means it will copy new members
when they exist.

Change-Id: I66a35ce5f88941f29aa6ffff13dd68807fe1e2f2
Signed-off-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/965
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/src/camessagehandler.c
resource/csdk/connectivity/src/camessagehandler_singlethread.c

index 66c27ce..635289c 100755 (executable)
@@ -278,15 +278,10 @@ static void CASendThreadProcess(void *threadData)
     {
         OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
 
-        CAInfo_t info = { };
+        CAInfo_t info = data->requestInfo->info;
 
         info.options = data->options;
         info.numOptions = data->numOptions;
-        info.token = data->requestInfo->info.token;
-        info.tokenLength = data->requestInfo->info.tokenLength;
-        info.type = data->requestInfo->info.type;
-        info.messageId = data->requestInfo->info.messageId;
-        info.payload = data->requestInfo->info.payload;
 
         coap_pdu_t *pdu = (coap_pdu_t *) CAGeneratePDU(data->remoteEndpoint->resourceUri, CA_GET,
                                                        info);
index 1263505..6bad8a3 100644 (file)
@@ -156,15 +156,10 @@ static void CAProcessData(const CAData_t *data)
     {
         OIC_LOG(DEBUG, TAG, "both requestInfo & responseInfo is not available");
 
-        CAInfo_t info = { 0 };
+        CAInfo_t info = data->requestInfo->info;
 
         info.options = data->options;
         info.numOptions = data->numOptions;
-        info.token = data->requestInfo->info.token;
-        info.tokenLength = data->requestInfo->info.tokenLength;
-        info.type = data->requestInfo->info.type;
-        info.messageId = data->requestInfo->info.messageId;
-        info.payload = data->requestInfo->info.payload;
 
         coap_pdu_t *pdu = (coap_pdu_t *) CAGeneratePDU(data->remoteEndpoint->resourceUri, CA_GET,
                                                        info);