Replaced simple iterator usages.
This commit is contained in:
@@ -213,13 +213,13 @@ static bool ts_list_is_host(linked_list_t *list, host_t *host)
|
||||
{
|
||||
traffic_selector_t *ts;
|
||||
bool is_host = TRUE;
|
||||
iterator_t *iterator = list->create_iterator(list, TRUE);
|
||||
enumerator_t *enumerator = list->create_enumerator(list);
|
||||
|
||||
while (is_host && iterator->iterate(iterator, (void**)&ts))
|
||||
while (is_host && enumerator->enumerate(enumerator, (void**)&ts))
|
||||
{
|
||||
is_host = is_host && ts->is_host(ts, host);
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
return is_host;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,11 +73,11 @@ struct private_child_delete_t {
|
||||
static void build_payloads(private_child_delete_t *this, message_t *message)
|
||||
{
|
||||
delete_payload_t *ah = NULL, *esp = NULL;
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
child_sa_t *child_sa;
|
||||
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
enumerator = this->child_sas->create_enumerator(this->child_sas);
|
||||
while (enumerator->enumerate(enumerator, (void**)&child_sa))
|
||||
{
|
||||
protocol_id_t protocol = child_sa->get_protocol(child_sa);
|
||||
u_int32_t spi = child_sa->get_spi(child_sa, TRUE);
|
||||
@@ -109,7 +109,7 @@ static void build_payloads(private_child_delete_t *this, message_t *message)
|
||||
}
|
||||
child_sa->set_state(child_sa, CHILD_DELETING);
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ static void process_payloads(private_child_delete_t *this, message_t *message)
|
||||
*/
|
||||
static status_t destroy_and_reestablish(private_child_delete_t *this)
|
||||
{
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
child_sa_t *child_sa;
|
||||
child_cfg_t *child_cfg;
|
||||
protocol_id_t protocol;
|
||||
@@ -194,8 +194,8 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
|
||||
action_t action;
|
||||
status_t status = SUCCESS;
|
||||
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
enumerator = this->child_sas->create_enumerator(this->child_sas);
|
||||
while (enumerator->enumerate(enumerator, (void**)&child_sa))
|
||||
{
|
||||
/* signal child down event if we are not rekeying */
|
||||
if (!this->rekeyed)
|
||||
@@ -231,7 +231,7 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
|
||||
break;
|
||||
}
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -240,12 +240,12 @@ static status_t destroy_and_reestablish(private_child_delete_t *this)
|
||||
*/
|
||||
static void log_children(private_child_delete_t *this)
|
||||
{
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
child_sa_t *child_sa;
|
||||
u_int64_t bytes_in, bytes_out;
|
||||
|
||||
iterator = this->child_sas->create_iterator(this->child_sas, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&child_sa))
|
||||
enumerator = this->child_sas->create_enumerator(this->child_sas);
|
||||
while (enumerator->enumerate(enumerator, (void**)&child_sa))
|
||||
{
|
||||
child_sa->get_usestats(child_sa, TRUE, NULL, &bytes_in);
|
||||
child_sa->get_usestats(child_sa, FALSE, NULL, &bytes_out);
|
||||
@@ -258,7 +258,7 @@ static void log_children(private_child_delete_t *this)
|
||||
child_sa->get_traffic_selectors(child_sa, TRUE),
|
||||
child_sa->get_traffic_selectors(child_sa, FALSE));
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,7 +112,7 @@ static void build_payloads(private_ike_init_t *this, message_t *message)
|
||||
linked_list_t *proposal_list;
|
||||
ike_sa_id_t *id;
|
||||
proposal_t *proposal;
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
|
||||
id = this->ike_sa->get_id(this->ike_sa);
|
||||
|
||||
@@ -124,12 +124,12 @@ static void build_payloads(private_ike_init_t *this, message_t *message)
|
||||
if (this->old_sa)
|
||||
{
|
||||
/* include SPI of new IKE_SA when we are rekeying */
|
||||
iterator = proposal_list->create_iterator(proposal_list, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&proposal))
|
||||
enumerator = proposal_list->create_enumerator(proposal_list);
|
||||
while (enumerator->enumerate(enumerator, (void**)&proposal))
|
||||
{
|
||||
proposal->set_spi(proposal, id->get_initiator_spi(id));
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
sa_payload = sa_payload_create_from_proposal_list(proposal_list);
|
||||
|
||||
@@ -111,15 +111,15 @@ struct private_ike_me_t {
|
||||
*/
|
||||
static void add_endpoints_to_message(message_t *message, linked_list_t *endpoints)
|
||||
{
|
||||
iterator_t *iterator;
|
||||
enumerator_t *enumerator;
|
||||
endpoint_notify_t *endpoint;
|
||||
|
||||
iterator = endpoints->create_iterator(endpoints, TRUE);
|
||||
while (iterator->iterate(iterator, (void**)&endpoint))
|
||||
enumerator = endpoints->create_enumerator(endpoints);
|
||||
while (enumerator->enumerate(enumerator, (void**)&endpoint))
|
||||
{
|
||||
message->add_payload(message, (payload_t*)endpoint->build_notify(endpoint));
|
||||
}
|
||||
iterator->destroy(iterator);
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user