mirror of
https://gitlab.xiph.org/xiph/icecast-common.git
synced 2024-12-04 14:46:31 -05:00
Feature: Added igloo_list_clear()
This commit is contained in:
parent
4b579f596c
commit
28fea532cf
@ -45,6 +45,7 @@ struct igloo_list_iterator_tag {
|
||||
* Those types are defined here as they must be known to the compiler.
|
||||
* Nobody should ever try to access them directly.
|
||||
*/
|
||||
int igloo_list_clear(igloo_list_t *list);
|
||||
void igloo_list_preallocate(igloo_list_t *list, size_t request);
|
||||
int igloo_list_set_type__real(igloo_list_t *list, const igloo_ro_type_t *type);
|
||||
#define igloo_list_set_type(list,type) igloo_list_set_type__real((list),(igloo_ro__type__ ## type))
|
||||
|
13
src/list.c
13
src/list.c
@ -44,11 +44,24 @@ igloo_RO_PUBLIC_TYPE(igloo_list_t,
|
||||
static void __free(igloo_ro_t self)
|
||||
{
|
||||
igloo_list_t *list = igloo_RO_TO_TYPE(self, igloo_list_t);
|
||||
igloo_list_clear(list);
|
||||
}
|
||||
|
||||
int igloo_list_clear(igloo_list_t *list)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if (!igloo_RO_IS_VALID(list, igloo_list_t))
|
||||
return -1;
|
||||
|
||||
for (i = list->offset; i < list->fill; i++) {
|
||||
igloo_ro_unref(list->elements[i]);
|
||||
}
|
||||
|
||||
list->offset = 0;
|
||||
list->fill = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void igloo_list_preallocate__realign(igloo_list_t *list)
|
||||
|
Loading…
Reference in New Issue
Block a user