From 70be4fc34b31feb4b5d1f8f3ab799e6128ffce44 Mon Sep 17 00:00:00 2001 From: "jihwan.seo" Date: Tue, 21 Apr 2015 14:02:40 +0900 Subject: [PATCH] Index variable has modified to define inside of for loop 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/792 Tested-by: jenkins-iotivity Reviewed-by: Habib Virji Reviewed-by: Ashok Babu Channa Reviewed-by: Erich Keane --- resource/csdk/connectivity/src/canetworkconfigurator.c | 3 +-- resource/csdk/connectivity/src/caprotocolmessage.c | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/resource/csdk/connectivity/src/canetworkconfigurator.c b/resource/csdk/connectivity/src/canetworkconfigurator.c index 513969a2a..e5ccede3f 100644 --- a/resource/csdk/connectivity/src/canetworkconfigurator.c +++ b/resource/csdk/connectivity/src/canetworkconfigurator.c @@ -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) diff --git a/resource/csdk/connectivity/src/caprotocolmessage.c b/resource/csdk/connectivity/src/caprotocolmessage.c index a3a0949d3..ab9bbe4d9 100644 --- a/resource/csdk/connectivity/src/caprotocolmessage.c +++ b/resource/csdk/connectivity/src/caprotocolmessage.c @@ -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 -- 2.34.1