BLOG | DOCUMENTATION | GITHUB

Home --> Documentations --> PJLIB Reference

list.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
3 * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef __PJ_LIST_H__
20#define __PJ_LIST_H__
21
27#include <pj/types.h>
28
30
31/*
32 * @defgroup PJ_DS Data Structure.
33 */
34
61#define PJ_DECL_LIST_MEMBER(type) \
62 \
63 type *prev; \
64 \
65 type *next
66
67
73struct pj_list
74{
76} PJ_ATTR_MAY_ALIAS; /* may_alias avoids warning with gcc-4.4 -Wall -O2 */
77
78
88{
89 ((pj_list*)node)->next = ((pj_list*)node)->prev = node;
90}
91
92
102{
103 return ((pj_list*)node)->next == node;
104}
105
106
115
116
125{
126 pj_list_insert_before(list, node);
127}
128
129
137 pj_list_type *nodes);
138
148
149
158{
159 pj_list_insert_after(list, node);
160}
161
162
170 pj_list_type *nodes);
171
172
187
188
204
205
212
213
224 pj_list_type *node);
225
226
242 int (*comp)(void *value,
243 const pj_list_type *node)
244 );
245
246
255
256
261#if PJ_FUNCTIONS_ARE_INLINED
262# include "list_i.h"
263#endif
264
266
267#endif /* __PJ_LIST_H__ */
268
void pj_list_type
Definition: types.h:157
size_t pj_size_t
Definition: types.h:58
void pj_list_init(pj_list_type *node)
Definition: list.h:87
#define PJ_DECL_LIST_MEMBER(type)
Definition: list.h:61
void pj_list_erase(pj_list_type *node)
void pj_list_merge_first(pj_list_type *list1, pj_list_type *list2)
void pj_list_insert_nodes_before(pj_list_type *lst, pj_list_type *nodes)
void pj_list_insert_nodes_after(pj_list_type *lst, pj_list_type *nodes)
void pj_list_insert_after(pj_list_type *pos, pj_list_type *node)
int pj_list_empty(const pj_list_type *node)
Definition: list.h:101
pj_list_type * pj_list_search(pj_list_type *list, void *value, int(*comp)(void *value, const pj_list_type *node))
void pj_list_merge_last(pj_list_type *list1, pj_list_type *list2)
pj_list_type * pj_list_find_node(pj_list_type *list, pj_list_type *node)
void pj_list_push_back(pj_list_type *list, pj_list_type *node)
Definition: list.h:124
void pj_list_insert_before(pj_list_type *pos, pj_list_type *node)
pj_size_t pj_list_size(const pj_list_type *list)
void pj_list_push_front(pj_list_type *list, pj_list_type *node)
Definition: list.h:157
#define PJ_BEGIN_DECL
Definition: config.h:1284
#define PJ_IDECL(type)
Definition: config.h:1333
#define PJ_INLINE(type)
Definition: config.h:1178
#define PJ_END_DECL
Definition: config.h:1285
Definition: list.h:74
Declaration of basic types and utility.

 


PJLIB Open Source, high performance, small footprint, and very very portable framework
Copyright (C) 2006-2009 Teluu Inc.