btstack_tlv_posix: add btstack_tlv_posix_deinit

This commit is contained in:
Matthias Ringwald 2020-01-29 17:10:44 +01:00
parent ac51aada34
commit 4129d206a9
2 changed files with 20 additions and 0 deletions

View File

@ -264,3 +264,17 @@ const btstack_tlv_t * btstack_tlv_posix_init_instance(btstack_tlv_posix_t * self
return &btstack_tlv_posix;
}
/**
* Free TLV entries
* @param self
*/
void btstack_tlv_posix_deinit(btstack_tlv_posix_t * self){
// free all entries
btstack_linked_list_iterator_t it;
btstack_linked_list_iterator_init(&it, &self->entry_list);
while (btstack_linked_list_iterator_has_next(&it)){
tlv_entry_t * entry = (tlv_entry_t*) btstack_linked_list_iterator_next(&it);
btstack_linked_list_iterator_remove(&it);
free(entry);
}
}

View File

@ -61,6 +61,12 @@ typedef struct {
*/
const btstack_tlv_t * btstack_tlv_posix_init_instance(btstack_tlv_posix_t * context, const char * db_path);
/**
* Free TLV entries
* @param self
*/
void btstack_tlv_posix_deinit(btstack_tlv_posix_t * self);
#if defined __cplusplus
}
#endif