mirror of
https://github.com/ZDoom/fluidsynth.git
synced 2024-12-02 17:12:15 +00:00
Add fluid_list function to find index of data in list
Will be used in the defsfont dump utility.
This commit is contained in:
parent
8a39c5aea4
commit
1b61e1fbd3
2 changed files with 17 additions and 0 deletions
|
@ -319,3 +319,19 @@ fluid_list_str_compare_func(void *a, void *b)
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int fluid_list_idx(fluid_list_t *list, void *data)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
while(list)
|
||||
{
|
||||
if (list->data == data)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
list = list->next;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -52,6 +52,7 @@ fluid_list_t *fluid_list_remove_link(fluid_list_t *list, fluid_list_t *llink);
|
|||
fluid_list_t *fluid_list_nth(fluid_list_t *list, int n);
|
||||
fluid_list_t *fluid_list_last(fluid_list_t *list);
|
||||
fluid_list_t *fluid_list_insert_at(fluid_list_t *list, int n, void *data);
|
||||
int fluid_list_idx(fluid_list_t *list, void *data);
|
||||
int fluid_list_size(fluid_list_t *list);
|
||||
|
||||
#define fluid_list_next(slist) ((slist) ? (((fluid_list_t *)(slist))->next) : NULL)
|
||||
|
|
Loading…
Reference in a new issue