diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/list.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c index 66d52f70..a3a22d8f 100644 --- a/common/list.c +++ b/common/list.c | |||
@@ -77,6 +77,15 @@ int list_seq_find(list_t *list, int compare(const void *item, const void *data), | |||
77 | return -1; | 77 | return -1; |
78 | } | 78 | } |
79 | 79 | ||
80 | int list_find(list_t *list, void *item) { | ||
81 | for (int i = 0; i < list->length; i++) { | ||
82 | if (list->items[i] == item) { | ||
83 | return i; | ||
84 | } | ||
85 | } | ||
86 | return -1; | ||
87 | } | ||
88 | |||
80 | void list_swap(list_t *list, int src, int dest) { | 89 | void list_swap(list_t *list, int src, int dest) { |
81 | void *tmp = list->items[src]; | 90 | void *tmp = list->items[src]; |
82 | list->items[src] = list->items[dest]; | 91 | list->items[src] = list->items[dest]; |