2 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #define dlist_remove_data(list, data) do { \
20 l = dlist_find_data(list, data); \
21 list = dlist_remove(list, l); \
24 #define dlist_foreach(list, l, data) \
25 for ((l) = (list); (l) && ((data) = dlist_data(l)); (l) = dlist_next(l))
27 #define dlist_foreach_safe(list, l, n, data) \
28 for ((l) = (list), (n) = dlist_next(l); \
29 (l) && ((data) = dlist_data(l)); \
30 (l) = (n), (n) = dlist_next(l))
34 extern struct dlist *dlist_append(struct dlist *list, void *data);
35 extern struct dlist *dlist_prepend(struct dlist *list, void *data);
36 extern struct dlist *dlist_remove(struct dlist *list, struct dlist *l);
37 extern struct dlist *dlist_find_data(struct dlist *list, void *data);
38 extern void *dlist_data(struct dlist *l);
39 extern struct dlist *dlist_next(struct dlist *l);
40 extern struct dlist *dlist_prev(struct dlist *l);
41 extern int dlist_count(struct dlist *l);
42 extern struct dlist *dlist_nth(struct dlist *l, int nth);