summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-03-13 20:54:47 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-03-13 20:54:47 +0000
commit1477aa78883562b5d5e97e4ec6fa2d23216673c2 (patch)
treed40e8420180c283e1af85997cfdedeb6bdab8ad3 /common
parent1fe7ab081842276d8db73a44cc64c2115b618cc2 (diff)
More passkey handler functionality
Diffstat (limited to 'common')
-rw-r--r--common/list.c13
-rw-r--r--common/list.h5
2 files changed, 18 insertions, 0 deletions
diff --git a/common/list.c b/common/list.c
index bda2b564..c6d8cb98 100644
--- a/common/list.c
+++ b/common/list.c
@@ -86,6 +86,19 @@ struct slist *slist_remove(struct slist *list, void *data)
return list;
}
+struct slist *slist_find(struct slist *list, const void *data,
+ cmp_func_t cmp_func)
+{
+ struct slist *l;
+
+ for (l = list; l != NULL; l = l->next) {
+ if (!cmp_func(l->data, data))
+ return l;
+ }
+
+ return NULL;
+}
+
void slist_free(struct slist *list)
{
struct slist *l, *next;
diff --git a/common/list.h b/common/list.h
index b16bf946..1838370c 100644
--- a/common/list.h
+++ b/common/list.h
@@ -30,10 +30,15 @@ struct slist {
struct slist *next;
};
+typedef int (*cmp_func_t)(const void *a, const void *b);
+
struct slist *slist_append(struct slist *list, void *data);
struct slist *slist_remove(struct slist *list, void *data);
+struct slist *slist_find(struct slist *list, const void *data,
+ cmp_func_t cmp_func);
+
void slist_free(struct slist *list);
#endif /* __LIST_H */