Initialize Tizen 2.3
[framework/system/coord.git] / src / core / list.h
1 /*
2  * coord
3  *
4  * Copyright (c) 2014 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 <Ecore.h>
23
24 #ifdef EINA_LIST
25 typedef Eina_List c_list;
26 #define C_LIST_PREPEND(a, b)    \
27         a = eina_list_prepend(a, b)
28 #define C_LIST_APPEND(a, b)     \
29         a = eina_list_append(a, b)
30 #define C_LIST_REMOVE(a, b)     \
31         a = eina_list_remove(a, b)
32 #define C_LIST_LENGTH(a)                \
33         eina_list_count(a)
34 #define C_LIST_NTH(a, b)                        \
35         eina_list_nth(a, b)
36 #define C_LIST_FREE_LIST(a)    \
37         a = eina_list_free(a)
38 #define C_LIST_FOREACH(head, elem, node)        \
39         EINA_LIST_FOREACH(head, elem, node)
40 #else
41 #include <glib.h>
42 typedef GList c_list;
43 #define C_LIST_PREPEND(a, b)            \
44         a = g_list_prepend(a, (gpointer)b)
45 #define C_LIST_APPEND(a, b)             \
46         a = g_list_append(a, (gpointer)b)
47 #define C_LIST_REMOVE(a, b)             \
48         a = g_list_remove(a, (gpointer)b)
49 #define C_LIST_LENGTH(a)                        \
50         g_list_length(a)
51 #define C_LIST_NTH(a, b)                        \
52         g_list_nth_data(a, b)
53 #define C_LIST_FREE_LIST(a)        \
54         g_list_free(a)
55 #define C_LIST_FOREACH(head, elem, node)        \
56         for (elem = head, node = NULL; elem && ((node = elem->data) != NULL); elem = elem->next, node = NULL)
57 #endif
58
59 #endif