Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 87 lines (74 sloc) 3.977 kb
573b460 @andigutmans Zend Library
andigutmans authored
1 /*
2 +----------------------------------------------------------------------+
3 | Zend Engine |
4 +----------------------------------------------------------------------+
e4ca0ed @felipensp - Year++
felipensp authored
5 | Copyright (c) 1998-2012 Zend Technologies Ltd. (http://www.zend.com) |
573b460 @andigutmans Zend Library
andigutmans authored
6 +----------------------------------------------------------------------+
d863d52 Update headers.
Sebastian Bergmann authored
7 | This source file is subject to version 2.00 of the Zend license, |
b5b1117 @zsuraski License update
zsuraski authored
8 | that is bundled with this package in the file LICENSE, and is |
f68c7ff updating license information in the headers.
James Cox authored
9 | available through the world-wide-web at the following url: |
d863d52 Update headers.
Sebastian Bergmann authored
10 | http://www.zend.com/license/2_00.txt. |
b5b1117 @zsuraski License update
zsuraski authored
11 | If you did not receive a copy of the Zend license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@zend.com so we can mail you a copy immediately. |
573b460 @andigutmans Zend Library
andigutmans authored
14 +----------------------------------------------------------------------+
15 | Authors: Andi Gutmans <andi@zend.com> |
16 | Zeev Suraski <zeev@zend.com> |
17 +----------------------------------------------------------------------+
18 */
19
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
20 /* $Id$ */
b5b1117 @zsuraski License update
zsuraski authored
21
b982307 Change header protection macros to conform to standard.
Sascha Schumann authored
22 #ifndef ZEND_LLIST_H
23 #define ZEND_LLIST_H
573b460 @andigutmans Zend Library
andigutmans authored
24
25 typedef struct _zend_llist_element {
26 struct _zend_llist_element *next;
27 struct _zend_llist_element *prev;
28 char data[1]; /* Needs to always be last in the struct */
29 } zend_llist_element;
30
9dd0231 @andigutmans - Add typedef for function pointer of llist dtor
andigutmans authored
31 typedef void (*llist_dtor_func_t)(void *);
cbec84d MFZE1
Andrei Zmievski authored
32 typedef int (*llist_compare_func_t)(const zend_llist_element **, const zend_llist_element ** TSRMLS_DC);
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
33 typedef void (*llist_apply_with_args_func_t)(void *data, int num_args, va_list args TSRMLS_DC);
34 typedef void (*llist_apply_with_arg_func_t)(void *data, void *arg TSRMLS_DC);
35 typedef void (*llist_apply_func_t)(void * TSRMLS_DC);
9dd0231 @andigutmans - Add typedef for function pointer of llist dtor
andigutmans authored
36
1250c43 @zsuraski * Add struct name to all typedef's so that they can be debugged with …
zsuraski authored
37 typedef struct _zend_llist {
573b460 @andigutmans Zend Library
andigutmans authored
38 zend_llist_element *head;
39 zend_llist_element *tail;
c57ed1b spaces->tabs
Sterling Hughes authored
40 size_t count;
41 size_t size;
9dd0231 @andigutmans - Add typedef for function pointer of llist dtor
andigutmans authored
42 llist_dtor_func_t dtor;
573b460 @andigutmans Zend Library
andigutmans authored
43 unsigned char persistent;
44 zend_llist_element *traverse_ptr;
45 } zend_llist;
46
26eaf66 Implemented external list traversing.
Andrei Zmievski authored
47 typedef zend_llist_element* zend_llist_position;
e6b7681 @andigutmans - Quick and dirty hack for supporting sorts. Improve later on when I …
andigutmans authored
48
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
49 BEGIN_EXTERN_C()
9dd0231 @andigutmans - Add typedef for function pointer of llist dtor
andigutmans authored
50 ZEND_API void zend_llist_init(zend_llist *l, size_t size, llist_dtor_func_t dtor, unsigned char persistent);
573b460 @andigutmans Zend Library
andigutmans authored
51 ZEND_API void zend_llist_add_element(zend_llist *l, void *element);
853d6c6 @zsuraski Added prepend to llist
zsuraski authored
52 ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element);
cd53944 @zsuraski - Modify zend_llist_del() to receive a comparison function
zsuraski authored
53 ZEND_API void zend_llist_del_element(zend_llist *l, void *element, int (*compare)(void *element1, void *element2));
573b460 @andigutmans Zend Library
andigutmans authored
54 ZEND_API void zend_llist_destroy(zend_llist *l);
c8b2bf0 @andigutmans llist improvements
andigutmans authored
55 ZEND_API void zend_llist_clean(zend_llist *l);
d87fa22 @andigutmans - Merge Sterling's patches from ZE1
andigutmans authored
56 ZEND_API void *zend_llist_remove_tail(zend_llist *l);
573b460 @andigutmans Zend Library
andigutmans authored
57 ZEND_API void zend_llist_copy(zend_llist *dst, zend_llist *src);
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
58 ZEND_API void zend_llist_apply(zend_llist *l, llist_apply_func_t func TSRMLS_DC);
928da71 @andigutmans - Try #2. Wasn't allowed to delete in the previous manner because we …
andigutmans authored
59 ZEND_API void zend_llist_apply_with_del(zend_llist *l, int (*func)(void *data));
d76cf1d @zsuraski More TSRMLS_FETCH work
zsuraski authored
60 ZEND_API void zend_llist_apply_with_argument(zend_llist *l, llist_apply_with_arg_func_t func, void *arg TSRMLS_DC);
61 ZEND_API void zend_llist_apply_with_arguments(zend_llist *l, llist_apply_with_args_func_t func TSRMLS_DC, int num_args, ...);
573b460 @andigutmans Zend Library
andigutmans authored
62 ZEND_API int zend_llist_count(zend_llist *l);
3bdddb4 MFZE1
Sebastian Bergmann authored
63 ZEND_API void zend_llist_sort(zend_llist *l, llist_compare_func_t comp_func TSRMLS_DC);
573b460 @andigutmans Zend Library
andigutmans authored
64
65 /* traversal */
26eaf66 Implemented external list traversing.
Andrei Zmievski authored
66 ZEND_API void *zend_llist_get_first_ex(zend_llist *l, zend_llist_position *pos);
67 ZEND_API void *zend_llist_get_last_ex(zend_llist *l, zend_llist_position *pos);
68 ZEND_API void *zend_llist_get_next_ex(zend_llist *l, zend_llist_position *pos);
69 ZEND_API void *zend_llist_get_prev_ex(zend_llist *l, zend_llist_position *pos);
70
71 #define zend_llist_get_first(l) zend_llist_get_first_ex(l, NULL)
72 #define zend_llist_get_last(l) zend_llist_get_last_ex(l, NULL)
73 #define zend_llist_get_next(l) zend_llist_get_next_ex(l, NULL)
74 #define zend_llist_get_prev(l) zend_llist_get_prev_ex(l, NULL)
75
87ba08d @zsuraski Avoid leaking fd's in case of failures
zsuraski authored
76 END_EXTERN_C()
573b460 @andigutmans Zend Library
andigutmans authored
77
b982307 Change header protection macros to conform to standard.
Sascha Schumann authored
78 #endif /* ZEND_LLIST_H */
333406b - Added some missing CVS $Id$ tags, headers and footers.
foobar authored
79
80 /*
81 * Local variables:
82 * tab-width: 4
83 * c-basic-offset: 4
84 * indent-tabs-mode: t
85 * End:
86 */
Something went wrong with that request. Please try again.