aboutsummaryrefslogtreecommitdiff
path: root/common/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/list.c')
-rw-r--r--common/list.c9
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),
return -1;
}
+int list_find(list_t *list, void *item) {
+ for (int i = 0; i < list->length; i++) {
+ if (list->items[i] == item) {
+ return i;
+ }
+ }
+ return -1;
+}
+
void list_swap(list_t *list, int src, int dest) {
void *tmp = list->items[src];
list->items[src] = list->items[dest];