Index variable has modified to define inside of for loop
authorjihwan.seo <jihwan.seo@samsung.com>
Tue, 21 Apr 2015 05:02:40 +0000 (14:02 +0900)
committerErich Keane <erich.keane@intel.com>
Mon, 27 Apr 2015 16:39:31 +0000 (16:39 +0000)
As per coding standards,
Index variable has modified to define inside of for loop
about caprotocolmessage / canetworkconfigurator

Change-Id: Id1fa11d800b8323dbbde209c8f93e54fd07b734b
Signed-off-by: jihwan.seo <jihwan.seo@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/792
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Habib Virji <habib.virji@samsung.com>
Reviewed-by: Ashok Babu Channa <ashok.channa@samsung.com>
Reviewed-by: Erich Keane <erich.keane@intel.com>
resource/csdk/connectivity/src/canetworkconfigurator.c
resource/csdk/connectivity/src/caprotocolmessage.c

index 513969a..e5ccede 100644 (file)
@@ -148,8 +148,7 @@ CAResult_t CARemoveNetworkType(CAConnectivityType_t connectivityType)
     }
 
     uint32_t selectedNetworkLength = u_arraylist_length(g_selectedNetworkList);
-    uint32_t index;
-    for (index = 0; index < selectedNetworkLength; index++)
+    for (uint32_t index = 0; index < selectedNetworkLength; index++)
     {
         void* ptrType = u_arraylist_get(g_selectedNetworkList, index);
         if (NULL == ptrType)
index a3a0949..ab9bbe4 100644 (file)
@@ -269,8 +269,7 @@ coap_pdu_t *CAGeneratePDUImpl(code_t code, coap_list_t *options, const CAInfo_t
 
     if (options)
     {
-        coap_list_t *opt;
-        for (opt = options; opt; opt = opt->next)
+        for (coap_list_t *opt = options; opt; opt = opt->next)
         {
             OIC_LOG_V(DEBUG, TAG, "[%s] opt will be added.",
                       COAP_OPTION_DATA(*(coap_option *) opt->data));
@@ -425,8 +424,7 @@ CAResult_t CAParseHeadOption(uint32_t code, const CAInfo_t info, coap_list_t **o
         return CA_STATUS_INVALID_PARAM;
     }
 
-    uint32_t i;
-    for (i = 0; i < info.numOptions; i++)
+    for (uint32_t i = 0; i < info.numOptions; i++)
     {
         if(!(info.options + i))
         {
@@ -817,8 +815,7 @@ CAResult_t CAGenerateTokenInternal(CAToken_t *token, uint8_t tokenLength)
     }
 
     // set random byte
-    uint8_t index;
-    for (index = 0; index < tokenLength; index++)
+    for (uint8_t index = 0; index < tokenLength; index++)
     {
         // use valid characters
 #ifdef ARDUINO