Add two utility functions to function_list.

This commit is contained in:
Danila Fedorin 2018-05-20 09:56:24 -07:00
parent 8a7c18b513
commit 72e143396c
2 changed files with 21 additions and 0 deletions

View File

@ -31,6 +31,19 @@ libab_result libab_function_list_init(libab_function_list* list);
*/
libab_result libab_function_list_insert(libab_function_list* list,
libab_ref* function_value);
/**
* Get the size of the given function list.
* @param list the list to get the size of.
* @return the size of the list.
*/
size_t libab_function_list_size(libab_function_list* list);
/**
* Gets a value at the given index in the list.
* @param list the list to get a value from.
* @param index the index at which to get the value.
* @param into the reference to store the function into.
*/
void libab_function_list_index(libab_function_list* list, size_t index, libab_ref* into);
/**
* Frees the given function list.
* @param list the list to free.

View File

@ -9,6 +9,14 @@ libab_result libab_function_list_insert(libab_function_list* list,
return libab_ref_vec_insert(&list->functions, function);
}
size_t libab_function_list_size(libab_function_list* list) {
return list->functions.size;
}
void libab_function_list_index(libab_function_list* list, size_t index, libab_ref* into) {
libab_ref_vec_index(&list->functions, index, into);
}
void libab_function_list_free(libab_function_list* list) {
libab_ref_vec_free(&list->functions);
}