Lines Matching refs:set
12 ds_set_t *set = ecalloc(1, sizeof(ds_set_t)); in ds_set_ex() local
13 set->table = table; in ds_set_ex()
14 return set; in ds_set_ex()
22 ds_set_t *ds_set_clone(ds_set_t *set) in ds_set_clone() argument
24 return ds_set_ex(ds_htable_clone(set->table)); in ds_set_clone()
27 void ds_set_allocate(ds_set_t *set, zend_long capacity) in ds_set_allocate() argument
29 ds_htable_ensure_capacity(set->table, capacity); in ds_set_allocate()
32 void ds_set_sort_callback(ds_set_t *set) in ds_set_sort_callback() argument
34 ds_htable_sort_callback_by_key(set->table); in ds_set_sort_callback()
37 void ds_set_sort(ds_set_t *set) in ds_set_sort() argument
39 ds_htable_sort_by_key(set->table); in ds_set_sort()
42 ds_set_t *ds_set_sorted_callback(ds_set_t *set) in ds_set_sorted_callback() argument
44 ds_set_t *sorted = ds_set_clone(set); in ds_set_sorted_callback()
49 ds_set_t *ds_set_sorted(ds_set_t *set) in ds_set_sorted() argument
51 ds_set_t *sorted = ds_set_clone(set); in ds_set_sorted()
56 void ds_set_add(ds_set_t *set, zval *value) in ds_set_add() argument
58 ds_htable_put(set->table, value, NULL); in ds_set_add()
61 void ds_set_add_va(ds_set_t *set, VA_PARAMS) in ds_set_add_va() argument
64 ds_set_add(set, argv); in ds_set_add_va()
74 static inline void add_traversable_to_set(ds_set_t *set, zval *obj) in add_traversable_to_set() argument
76 spl_iterator_apply(obj, iterator_add, set); in add_traversable_to_set()
79 static inline void add_array_to_set(ds_set_t *set, HashTable *array) in add_array_to_set() argument
84 ds_set_add(set, value); in add_array_to_set()
89 void ds_set_add_all(ds_set_t *set, zval *values) in ds_set_add_all() argument
96 add_array_to_set(set, Z_ARRVAL_P(values)); in ds_set_add_all()
101 add_traversable_to_set(set, values); in ds_set_add_all()
108 bool ds_set_contains(ds_set_t *set, zval *value) in ds_set_contains() argument
110 return ds_htable_has_key(set->table, value); in ds_set_contains()
113 bool ds_set_contains_va(ds_set_t *set, VA_PARAMS) in ds_set_contains_va() argument
115 return ds_htable_has_keys(set->table, argc, argv); in ds_set_contains_va()
118 static inline void ds_set_remove(ds_set_t *set, zval *value) in ds_set_remove() argument
120 ds_htable_remove(set->table, value, NULL); in ds_set_remove()
123 void ds_set_remove_va(ds_set_t *set, VA_PARAMS) in ds_set_remove_va() argument
126 ds_set_remove(set, argv++); in ds_set_remove_va()
130 zval *ds_set_get(ds_set_t *set, zend_long index) in ds_set_get() argument
132 ds_htable_bucket_t *bucket = ds_htable_lookup_by_position(set->table, index); in ds_set_get()
138 INDEX_OUT_OF_RANGE(index, set->table->size); in ds_set_get()
142 zval *ds_set_get_first(ds_set_t *set) in ds_set_get_first() argument
144 ds_htable_bucket_t *bucket = ds_htable_lookup_by_position(set->table, 0); in ds_set_get_first()
154 zval *ds_set_get_last(ds_set_t *set) in ds_set_get_last() argument
156 ds_htable_bucket_t *bucket = ds_htable_lookup_by_position(set->table, DS_SET_SIZE(set) - 1); in ds_set_get_last()
166 void ds_set_join(ds_set_t *set, const char *glue, const size_t len, zval *return_value) in ds_set_join() argument
168 zend_string *str = ds_htable_join_keys(set->table, glue, len); in ds_set_join()
172 ds_set_t *ds_set_slice(ds_set_t *set, zend_long index, zend_long length) in ds_set_slice() argument
174 return ds_set_ex(ds_htable_slice(set->table, index, length)); in ds_set_slice()
177 ds_set_t *ds_set_diff(ds_set_t *set, ds_set_t *other) in ds_set_diff() argument
179 return ds_set_ex(ds_htable_diff(set->table, other->table)); in ds_set_diff()
182 void ds_set_assign_diff(ds_set_t *set, ds_set_t *other) in ds_set_assign_diff() argument
186 ds_set_remove(set, value); in ds_set_assign_diff()
191 ds_set_t *ds_set_intersect(ds_set_t *set, ds_set_t *other) in ds_set_intersect() argument
193 return ds_set_ex(ds_htable_intersect(set->table, other->table)); in ds_set_intersect()
196 void ds_set_assign_intersect(ds_set_t *set, ds_set_t *other) in ds_set_assign_intersect() argument
199 DS_SET_FOREACH(set, value) { in ds_set_assign_intersect()
201 ds_set_remove(set, value); in ds_set_assign_intersect()
208 ds_set_t *ds_set_xor(ds_set_t *set, ds_set_t *other) in ds_set_xor() argument
210 return ds_set_ex(ds_htable_xor(set->table, other->table)); in ds_set_xor()
214 void ds_set_assign_xor(ds_set_t *set, ds_set_t *other) in ds_set_assign_xor() argument
218 DS_SET_FOREACH(set, value) { in ds_set_assign_xor()
220 ds_set_remove(set, value); in ds_set_assign_xor()
226 ds_set_remove(set, value); in ds_set_assign_xor()
231 ds_set_t *ds_set_union(ds_set_t *set, ds_set_t *other) in ds_set_union() argument
233 return ds_set_ex(ds_htable_merge(set->table, other->table)); in ds_set_union()
236 ds_set_t *ds_set_merge(ds_set_t *set, zval *values) in ds_set_merge() argument
239 ds_set_t *merged = ds_set_clone(set); in ds_set_merge()
248 void ds_set_assign_union(ds_set_t *set, ds_set_t *other) in ds_set_assign_union() argument
252 ds_set_add(set, value); in ds_set_assign_union()
257 void ds_set_clear(ds_set_t *set) in ds_set_clear() argument
259 ds_htable_clear(set->table); in ds_set_clear()
262 void ds_set_free(ds_set_t *set) in ds_set_free() argument
264 ds_htable_free(set->table); in ds_set_free()
265 efree(set); in ds_set_free()
268 void ds_set_reduce(ds_set_t *set, FCI_PARAMS, zval *initial, zval *return_value) in ds_set_reduce() argument
280 DS_SET_FOREACH(set, value) { in ds_set_reduce()
299 ds_set_t * ds_set_map(ds_set_t *set, FCI_PARAMS) in ds_set_map() argument
303 if (DS_SET_IS_EMPTY(set)) { in ds_set_map()
309 DS_SET_FOREACH(set, value) { in ds_set_map()
330 ds_set_t *ds_set_filter_callback(ds_set_t *set, FCI_PARAMS) in ds_set_filter_callback() argument
334 if (DS_SET_IS_EMPTY(set)) { in ds_set_filter_callback()
340 DS_SET_FOREACH(set, value) { in ds_set_filter_callback()
364 ds_set_t *ds_set_filter(ds_set_t *set) in ds_set_filter() argument
368 if (DS_SET_IS_EMPTY(set)) { in ds_set_filter()
373 DS_SET_FOREACH(set, value) { in ds_set_filter()
384 void ds_set_reverse(ds_set_t *set) in ds_set_reverse() argument
386 ds_htable_reverse(set->table); in ds_set_reverse()
389 ds_set_t *ds_set_reversed(ds_set_t *set) in ds_set_reversed() argument
391 return ds_set_ex(ds_htable_reversed(set->table)); in ds_set_reversed()
394 void ds_set_to_array(ds_set_t *set, zval *arr) in ds_set_to_array() argument
398 array_init_size(arr, set->table->size); in ds_set_to_array()
400 DS_HTABLE_FOREACH_KEY(set->table, value) { in ds_set_to_array()
407 void ds_set_sum(ds_set_t *set, zval *return_value) in ds_set_sum() argument
412 DS_SET_FOREACH(set, value) { in ds_set_sum()