Add storage_is_mounted api
[platform/core/system/libstorage.git] / include / list.h
1 /*
2  * storage
3  *
4  * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 #ifndef __LIST_H__
20 #define __LIST_H__
21
22 #include <stdio.h>
23
24 #ifdef EINA_LIST
25 #include <Eina.h>
26 typedef Eina_List dd_list;
27 #define DD_LIST_PREPEND(a, b)   \
28         a = eina_list_prepend(a, b)
29 #define DD_LIST_APPEND(a, b)    \
30         a = eina_list_append(a, b)
31 #define DD_LIST_REMOVE(a, b)    \
32         a = eina_list_remove(a, b)
33 #define DD_LIST_LENGTH(a)               \
34         eina_list_count(a)
35 #define DD_LIST_NTH(a, b)                       \
36         eina_list_nth(a, b)
37 #define DD_LIST_FREE_LIST(a)    \
38         a = eina_list_free(a)
39 #define DD_LIST_FOREACH(head, elem, node)       \
40         EINA_LIST_FOREACH(head, elem, node)
41 #define DD_LIST_FOREACH_SAFE(head, elem, elem_next, node) \
42         EINA_LIST_FOREACH_SAFE(head, elem, elem_next, node)
43
44 #else
45 #include <glib.h>
46 typedef GList dd_list;
47 #define DD_LIST_PREPEND(a, b)           \
48         a = g_list_prepend(a, (gpointer)b)
49 #define DD_LIST_APPEND(a, b)            \
50         a = g_list_append(a, (gpointer)b)
51 #define DD_LIST_REMOVE(a, b)            \
52         a = g_list_remove(a, (gpointer)b)
53 #define DD_LIST_LENGTH(a)                       \
54         g_list_length(a)
55 #define DD_LIST_NTH(a, b)                       \
56         g_list_nth_data(a, b)
57 #define DD_LIST_FREE_LIST(a)        \
58         g_list_free(a)
59 #define DD_LIST_FOREACH(head, elem, node)       \
60         for (elem = head, node = NULL; elem && ((node = elem->data) != NULL); elem = elem->next, node = NULL)
61 #define DD_LIST_FOREACH_SAFE(head, elem, elem_next, node) \
62         for (elem = head, elem_next = g_list_next(elem), node = NULL; \
63                         elem && ((node = elem->data) != NULL); \
64                         elem = elem_next, elem_next = g_list_next(elem), node = NULL)
65
66 #endif
67
68 #endif