1 #ifndef DOUBLE_LIST_INCLUDED
2 #define DOUBLE_LIST_INCLUDED
4 /**************************************************************************//**
6 * A simple double-linked list.
8 * @note No thread protection so you will need to use appropriate
9 * synchronization if use spans multiple threads.
14 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
16 * Licensed under the Apache License, Version 2.0 (the "License");
17 * you may not use this file except in compliance with the License.
18 * You may obtain a copy of the License at
19 * http://www.apache.org/licenses/LICENSE-2.0
21 * Unless required by applicable law or agreed to in writing, software
22 * distributed under the License is distributed on an "AS IS" BASIS,
23 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 * See the License for the specific language governing permissions and
25 * limitations under the License.
27 ****************************************************************************/
29 typedef struct dlist_item
31 struct dlist_item * previous;
32 struct dlist_item * next;
36 /**************************************************************************//**
37 * Double-linked list structure
38 *****************************************************************************/
46 void dlist_initialize(DLIST * list);
47 void * dlist_pop_last(DLIST * list);
48 void dlist_push_first(DLIST * list, void * item);
49 void dlist_push_last(DLIST * list, void * item);
50 DLIST_ITEM * dlist_get_first(DLIST * list);
51 DLIST_ITEM * dlist_get_last(DLIST * list);
52 DLIST_ITEM * dlist_get_next(DLIST_ITEM * item);
53 int dlist_is_empty(DLIST * list);
54 int dlist_count(DLIST * list);