clear reason strings after delivering them
This commit is contained in:
@@ -360,6 +360,21 @@ METHOD(recommendations_t, create_reason_enumerator, enumerator_t*,
|
||||
(void*)reason_filter, NULL, NULL);
|
||||
}
|
||||
|
||||
METHOD(recommendations_t, clear_reasons, void,
|
||||
private_tnc_imv_recommendations_t *this)
|
||||
{
|
||||
enumerator_t *enumerator;
|
||||
recommendation_entry_t *entry;
|
||||
|
||||
enumerator = this->recs->create_enumerator(this->recs);
|
||||
while (enumerator->enumerate(enumerator, &entry))
|
||||
{
|
||||
chunk_clear(&entry->reason);
|
||||
chunk_clear(&entry->reason_language);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
}
|
||||
|
||||
METHOD(recommendations_t, destroy, void,
|
||||
private_tnc_imv_recommendations_t *this)
|
||||
{
|
||||
@@ -395,6 +410,7 @@ recommendations_t* tnc_imv_recommendations_create(linked_list_t *imv_list)
|
||||
.set_reason_string = _set_reason_string,
|
||||
.set_reason_language = _set_reason_language,
|
||||
.create_reason_enumerator = _create_reason_enumerator,
|
||||
.clear_reasons = _clear_reasons,
|
||||
.destroy = _destroy,
|
||||
},
|
||||
.recs = linked_list_create(),
|
||||
|
||||
@@ -351,6 +351,7 @@ static void check_and_build_recommendation(private_tnccs_11_t *this)
|
||||
this->batch->add_msg(this->batch, msg);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
this->recs->clear_reasons(this->recs);
|
||||
|
||||
/* we have reache the final state */
|
||||
this->delete_state = TRUE;
|
||||
|
||||
@@ -521,6 +521,7 @@ static void check_and_build_recommendation(private_tnccs_20_t *this)
|
||||
this->batch->add_msg(this->batch, msg);
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
this->recs->clear_reasons(this->recs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,6 +108,12 @@ struct recommendations_t {
|
||||
* @return enumerator
|
||||
*/
|
||||
enumerator_t* (*create_reason_enumerator)(recommendations_t *this);
|
||||
|
||||
/**
|
||||
* Clears all reason entries
|
||||
*/
|
||||
void (*clear_reasons)(recommendations_t *this);
|
||||
|
||||
/**
|
||||
* Destroys an imv_t object.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user