Tizen Native API
|
Eina_List and memory allocation
If you don't know how to create lists see Adding elements to Eina_List. In this example we also use Stringshare, however it should be possible to understand the code regardless of previous knowledge about it.
Here we have the usual list creation code with a twist, now we are using as data for the list memory that has to be freed later on.
This time we are going to iterate over our list in a different way:
And now we are going to iterate over the list backwards:
And now we need to free up the memory allocated during creation of the list:
- Note:
- We don't need to use eina_list_free() since EINA_LIST_FREE takes care of that.
And shut everything down:
The full source code can be found on the examples folder on the eina_list_04.c file.