pepper: Add an API for finding a list node containing the given item
authorTaekyun Kim <tkq.kim@samsung.com>
Thu, 6 Aug 2015 07:01:43 +0000 (16:01 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Thu, 6 Aug 2015 07:01:43 +0000 (16:01 +0900)
Change-Id: I80bcbbb5fb171d85d0f07315454ce3860eeeb0f1

src/lib/pepper/pepper-utils.h

index 63c074b..5adfdde 100644 (file)
@@ -163,6 +163,20 @@ pepper_list_insert_item(pepper_list_t *list, void *item)
     return elm;
 }
 
+static inline pepper_list_t *
+pepper_list_find_item(pepper_list_t *list, void *item)
+{
+    pepper_list_t *l;
+
+    PEPPER_LIST_FOR_EACH(list, l)
+    {
+        if (l->item == item)
+            return l;
+    }
+
+    return NULL;
+}
+
 static inline void
 pepper_list_remove(pepper_list_t *list, pepper_free_func_t free_func)
 {