This source file includes following definitions.
- gl_list_create_empty
- gl_list_nx_create_empty
- gl_list_nx_create
- gl_list_size
- gl_list_node_value
- gl_list_node_nx_set_value
- gl_list_next_node
- gl_list_previous_node
- gl_list_first_node
- gl_list_last_node
- gl_list_get_at
- gl_list_get_first
- gl_list_get_last
- gl_list_nx_set_at
- gl_list_nx_set_first
- gl_list_nx_set_last
- gl_list_search
- gl_list_search_from
- gl_list_search_from_to
- gl_list_indexof
- gl_list_indexof_from
- gl_list_indexof_from_to
- gl_list_nx_add_first
- gl_list_nx_add_last
- gl_list_nx_add_before
- gl_list_nx_add_after
- gl_list_nx_add_at
- gl_list_remove_node
- gl_list_remove_at
- gl_list_remove_first
- gl_list_remove_last
- gl_list_remove
- gl_list_free
- gl_list_iterator
- gl_list_iterator_from_to
- gl_list_iterator_next
- gl_list_iterator_free
- gl_sortedlist_search
- gl_sortedlist_search_from_to
- gl_sortedlist_indexof
- gl_sortedlist_indexof_from_to
- gl_sortedlist_nx_add
- gl_sortedlist_remove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _GL_LIST_H
19 #define _GL_LIST_H
20
21 #include <stdbool.h>
22 #include <stddef.h>
23
24 #ifndef _GL_INLINE_HEADER_BEGIN
25 #error "Please include config.h first."
26 #endif
27 _GL_INLINE_HEADER_BEGIN
28 #ifndef GL_LIST_INLINE
29 # define GL_LIST_INLINE _GL_INLINE
30 #endif
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 typedef bool (*gl_listelement_equals_fn) (const void *elt1, const void *elt2);
116
117
118
119 typedef size_t (*gl_listelement_hashcode_fn) (const void *elt);
120
121
122
123 typedef void (*gl_listelement_dispose_fn) (const void *elt);
124
125 struct gl_list_impl;
126
127 typedef struct gl_list_impl * gl_list_t;
128
129 struct gl_list_node_impl;
130
131
132
133 typedef struct gl_list_node_impl * gl_list_node_t;
134
135 struct gl_list_implementation;
136
137 typedef const struct gl_list_implementation * gl_list_implementation_t;
138
139 #if 0
140
141
142
143
144
145
146
147
148
149
150
151 extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
152 gl_listelement_equals_fn equals_fn,
153 gl_listelement_hashcode_fn hashcode_fn,
154 gl_listelement_dispose_fn dispose_fn,
155 bool allow_duplicates)
156
157 _GL_ATTRIBUTE_RETURNS_NONNULL;
158
159 extern gl_list_t gl_list_nx_create_empty (gl_list_implementation_t implementation,
160 gl_listelement_equals_fn equals_fn,
161 gl_listelement_hashcode_fn hashcode_fn,
162 gl_listelement_dispose_fn dispose_fn,
163 bool allow_duplicates)
164 ;
165
166
167
168
169
170
171
172
173
174
175
176
177
178 extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
179 gl_listelement_equals_fn equals_fn,
180 gl_listelement_hashcode_fn hashcode_fn,
181 gl_listelement_dispose_fn dispose_fn,
182 bool allow_duplicates,
183 size_t count, const void **contents)
184
185 _GL_ATTRIBUTE_RETURNS_NONNULL;
186
187 extern gl_list_t gl_list_nx_create (gl_list_implementation_t implementation,
188 gl_listelement_equals_fn equals_fn,
189 gl_listelement_hashcode_fn hashcode_fn,
190 gl_listelement_dispose_fn dispose_fn,
191 bool allow_duplicates,
192 size_t count, const void **contents)
193 ;
194
195
196 extern size_t gl_list_size (gl_list_t list);
197
198
199 extern const void * gl_list_node_value (gl_list_t list, gl_list_node_t node);
200
201
202
203 extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
204 const void *elt);
205
206 _GL_ATTRIBUTE_NODISCARD
207 extern int gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
208 const void *elt);
209
210
211
212 extern gl_list_node_t gl_list_next_node (gl_list_t list, gl_list_node_t node);
213
214
215
216 extern gl_list_node_t gl_list_previous_node (gl_list_t list, gl_list_node_t node);
217
218
219
220
221
222
223
224 extern gl_list_node_t gl_list_first_node (gl_list_t list);
225
226
227
228
229
230
231
232
233 extern gl_list_node_t gl_list_last_node (gl_list_t list);
234
235
236
237 extern const void * gl_list_get_at (gl_list_t list, size_t position);
238
239
240
241 extern const void * gl_list_get_first (gl_list_t list);
242
243
244
245 extern const void * gl_list_get_last (gl_list_t list);
246
247
248
249
250
251 extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
252 const void *elt);
253
254 _GL_ATTRIBUTE_NODISCARD
255 extern gl_list_node_t gl_list_nx_set_at (gl_list_t list, size_t position,
256 const void *elt);
257
258
259
260
261
262 extern gl_list_node_t gl_list_set_first (gl_list_t list, const void *elt);
263
264 _GL_ATTRIBUTE_NODISCARD
265 extern gl_list_node_t gl_list_nx_set_first (gl_list_t list, const void *elt);
266
267
268
269
270
271 extern gl_list_node_t gl_list_set_last (gl_list_t list, const void *elt);
272
273 _GL_ATTRIBUTE_NODISCARD
274 extern gl_list_node_t gl_list_nx_set_last (gl_list_t list, const void *elt);
275
276
277
278 extern gl_list_node_t gl_list_search (gl_list_t list, const void *elt);
279
280
281
282
283 extern gl_list_node_t gl_list_search_from (gl_list_t list, size_t start_index,
284 const void *elt);
285
286
287
288
289 extern gl_list_node_t gl_list_search_from_to (gl_list_t list,
290 size_t start_index,
291 size_t end_index,
292 const void *elt);
293
294
295
296 extern size_t gl_list_indexof (gl_list_t list, const void *elt);
297
298
299
300
301 extern size_t gl_list_indexof_from (gl_list_t list, size_t start_index,
302 const void *elt);
303
304
305
306
307 extern size_t gl_list_indexof_from_to (gl_list_t list,
308 size_t start_index, size_t end_index,
309 const void *elt);
310
311
312
313
314 extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
315
316 _GL_ATTRIBUTE_NODISCARD
317 extern gl_list_node_t gl_list_nx_add_first (gl_list_t list, const void *elt);
318
319
320
321
322 extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
323
324 _GL_ATTRIBUTE_NODISCARD
325 extern gl_list_node_t gl_list_nx_add_last (gl_list_t list, const void *elt);
326
327
328
329
330 extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
331 const void *elt);
332
333 _GL_ATTRIBUTE_NODISCARD
334 extern gl_list_node_t gl_list_nx_add_before (gl_list_t list,
335 gl_list_node_t node,
336 const void *elt);
337
338
339
340
341 extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
342 const void *elt);
343
344 _GL_ATTRIBUTE_NODISCARD
345 extern gl_list_node_t gl_list_nx_add_after (gl_list_t list, gl_list_node_t node,
346 const void *elt);
347
348
349
350
351 extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
352 const void *elt);
353
354 _GL_ATTRIBUTE_NODISCARD
355 extern gl_list_node_t gl_list_nx_add_at (gl_list_t list, size_t position,
356 const void *elt);
357
358
359
360 extern bool gl_list_remove_node (gl_list_t list, gl_list_node_t node);
361
362
363
364
365 extern bool gl_list_remove_at (gl_list_t list, size_t position);
366
367
368
369 extern bool gl_list_remove_first (gl_list_t list);
370
371
372
373 extern bool gl_list_remove_last (gl_list_t list);
374
375
376
377 extern bool gl_list_remove (gl_list_t list, const void *elt);
378
379
380
381
382
383 extern void gl_list_free (gl_list_t list);
384
385 #endif
386
387
388
389
390
391
392
393
394 typedef struct
395 {
396
397 const struct gl_list_implementation *vtable;
398
399 gl_list_t list;
400 size_t count;
401
402 void *p; void *q;
403 size_t i; size_t j;
404 } gl_list_iterator_t;
405
406 #if 0
407
408
409
410
411 extern gl_list_iterator_t gl_list_iterator (gl_list_t list);
412
413
414
415
416
417 extern gl_list_iterator_t gl_list_iterator_from_to (gl_list_t list,
418 size_t start_index,
419 size_t end_index);
420
421
422
423
424 extern bool gl_list_iterator_next (gl_list_iterator_t *iterator,
425 const void **eltp, gl_list_node_t *nodep);
426
427
428 extern void gl_list_iterator_free (gl_list_iterator_t *iterator);
429
430 #endif
431
432
433
434
435
436
437
438
439 typedef int (*gl_listelement_compar_fn) (const void *elt1, const void *elt2);
440
441 #if 0
442
443
444
445
446
447
448 extern gl_list_node_t gl_sortedlist_search (gl_list_t list,
449 gl_listelement_compar_fn compar,
450 const void *elt);
451
452
453
454
455
456
457
458
459
460 extern gl_list_node_t gl_sortedlist_search_from_to (gl_list_t list,
461 gl_listelement_compar_fn compar,
462 size_t start_index,
463 size_t end_index,
464 const void *elt);
465
466
467
468
469
470
471 extern size_t gl_sortedlist_indexof (gl_list_t list,
472 gl_listelement_compar_fn compar,
473 const void *elt);
474
475
476
477
478
479
480
481
482
483 extern size_t gl_sortedlist_indexof_from_to (gl_list_t list,
484 gl_listelement_compar_fn compar,
485 size_t start_index,
486 size_t end_index,
487 const void *elt);
488
489
490
491
492
493 extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
494 gl_listelement_compar_fn compar,
495 const void *elt);
496
497 _GL_ATTRIBUTE_NODISCARD
498 extern gl_list_node_t gl_sortedlist_nx_add (gl_list_t list,
499 gl_listelement_compar_fn compar,
500 const void *elt);
501
502
503
504
505
506
507 extern bool gl_sortedlist_remove (gl_list_t list,
508 gl_listelement_compar_fn compar,
509 const void *elt);
510
511 #endif
512
513
514
515 struct gl_list_implementation
516 {
517
518 gl_list_t (*nx_create_empty) (gl_list_implementation_t implementation,
519 gl_listelement_equals_fn equals_fn,
520 gl_listelement_hashcode_fn hashcode_fn,
521 gl_listelement_dispose_fn dispose_fn,
522 bool allow_duplicates);
523 gl_list_t (*nx_create) (gl_list_implementation_t implementation,
524 gl_listelement_equals_fn equals_fn,
525 gl_listelement_hashcode_fn hashcode_fn,
526 gl_listelement_dispose_fn dispose_fn,
527 bool allow_duplicates,
528 size_t count, const void **contents);
529 size_t (*size) (gl_list_t list);
530 const void * (*node_value) (gl_list_t list, gl_list_node_t node);
531 int (*node_nx_set_value) (gl_list_t list, gl_list_node_t node,
532 const void *elt);
533 gl_list_node_t (*next_node) (gl_list_t list, gl_list_node_t node);
534 gl_list_node_t (*previous_node) (gl_list_t list, gl_list_node_t node);
535 gl_list_node_t (*first_node) (gl_list_t list);
536 gl_list_node_t (*last_node) (gl_list_t list);
537 const void * (*get_at) (gl_list_t list, size_t position);
538 gl_list_node_t (*nx_set_at) (gl_list_t list, size_t position,
539 const void *elt);
540 gl_list_node_t (*search_from_to) (gl_list_t list, size_t start_index,
541 size_t end_index, const void *elt);
542 size_t (*indexof_from_to) (gl_list_t list, size_t start_index,
543 size_t end_index, const void *elt);
544 gl_list_node_t (*nx_add_first) (gl_list_t list, const void *elt);
545 gl_list_node_t (*nx_add_last) (gl_list_t list, const void *elt);
546 gl_list_node_t (*nx_add_before) (gl_list_t list, gl_list_node_t node,
547 const void *elt);
548 gl_list_node_t (*nx_add_after) (gl_list_t list, gl_list_node_t node,
549 const void *elt);
550 gl_list_node_t (*nx_add_at) (gl_list_t list, size_t position,
551 const void *elt);
552 bool (*remove_node) (gl_list_t list, gl_list_node_t node);
553 bool (*remove_at) (gl_list_t list, size_t position);
554 bool (*remove_elt) (gl_list_t list, const void *elt);
555 void (*list_free) (gl_list_t list);
556
557 gl_list_iterator_t (*iterator) (gl_list_t list);
558 gl_list_iterator_t (*iterator_from_to) (gl_list_t list,
559 size_t start_index,
560 size_t end_index);
561 bool (*iterator_next) (gl_list_iterator_t *iterator,
562 const void **eltp, gl_list_node_t *nodep);
563 void (*iterator_free) (gl_list_iterator_t *iterator);
564
565 gl_list_node_t (*sortedlist_search) (gl_list_t list,
566 gl_listelement_compar_fn compar,
567 const void *elt);
568 gl_list_node_t (*sortedlist_search_from_to) (gl_list_t list,
569 gl_listelement_compar_fn compar,
570 size_t start_index,
571 size_t end_index,
572 const void *elt);
573 size_t (*sortedlist_indexof) (gl_list_t list,
574 gl_listelement_compar_fn compar,
575 const void *elt);
576 size_t (*sortedlist_indexof_from_to) (gl_list_t list,
577 gl_listelement_compar_fn compar,
578 size_t start_index, size_t end_index,
579 const void *elt);
580 gl_list_node_t (*sortedlist_nx_add) (gl_list_t list,
581 gl_listelement_compar_fn compar,
582 const void *elt);
583 bool (*sortedlist_remove) (gl_list_t list,
584 gl_listelement_compar_fn compar,
585 const void *elt);
586 };
587
588 struct gl_list_impl_base
589 {
590 const struct gl_list_implementation *vtable;
591 gl_listelement_equals_fn equals_fn;
592 gl_listelement_hashcode_fn hashcode_fn;
593 gl_listelement_dispose_fn dispose_fn;
594 bool allow_duplicates;
595 };
596
597
598
599
600 GL_LIST_INLINE
601
602 gl_list_t
603 gl_list_nx_create_empty (gl_list_implementation_t implementation,
604 gl_listelement_equals_fn equals_fn,
605 gl_listelement_hashcode_fn hashcode_fn,
606 gl_listelement_dispose_fn dispose_fn,
607 bool allow_duplicates)
608 {
609 return implementation->nx_create_empty (implementation, equals_fn,
610 hashcode_fn, dispose_fn,
611 allow_duplicates);
612 }
613
614 GL_LIST_INLINE
615
616 gl_list_t
617 gl_list_nx_create (gl_list_implementation_t implementation,
618 gl_listelement_equals_fn equals_fn,
619 gl_listelement_hashcode_fn hashcode_fn,
620 gl_listelement_dispose_fn dispose_fn,
621 bool allow_duplicates,
622 size_t count, const void **contents)
623 {
624 return implementation->nx_create (implementation, equals_fn, hashcode_fn,
625 dispose_fn, allow_duplicates, count,
626 contents);
627 }
628
629 GL_LIST_INLINE size_t
630 gl_list_size (gl_list_t list)
631 {
632 return ((const struct gl_list_impl_base *) list)->vtable
633 ->size (list);
634 }
635
636 GL_LIST_INLINE const void *
637 gl_list_node_value (gl_list_t list, gl_list_node_t node)
638 {
639 return ((const struct gl_list_impl_base *) list)->vtable
640 ->node_value (list, node);
641 }
642
643 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE int
644 gl_list_node_nx_set_value (gl_list_t list, gl_list_node_t node,
645 const void *elt)
646 {
647 return ((const struct gl_list_impl_base *) list)->vtable
648 ->node_nx_set_value (list, node, elt);
649 }
650
651 GL_LIST_INLINE gl_list_node_t
652 gl_list_next_node (gl_list_t list, gl_list_node_t node)
653 {
654 return ((const struct gl_list_impl_base *) list)->vtable
655 ->next_node (list, node);
656 }
657
658 GL_LIST_INLINE gl_list_node_t
659 gl_list_previous_node (gl_list_t list, gl_list_node_t node)
660 {
661 return ((const struct gl_list_impl_base *) list)->vtable
662 ->previous_node (list, node);
663 }
664
665 GL_LIST_INLINE gl_list_node_t
666 gl_list_first_node (gl_list_t list)
667 {
668 return ((const struct gl_list_impl_base *) list)->vtable
669 ->first_node (list);
670 }
671
672 GL_LIST_INLINE gl_list_node_t
673 gl_list_last_node (gl_list_t list)
674 {
675 return ((const struct gl_list_impl_base *) list)->vtable
676 ->last_node (list);
677 }
678
679 GL_LIST_INLINE const void *
680 gl_list_get_at (gl_list_t list, size_t position)
681 {
682 return ((const struct gl_list_impl_base *) list)->vtable
683 ->get_at (list, position);
684 }
685
686 GL_LIST_INLINE const void *
687 gl_list_get_first (gl_list_t list)
688 {
689 return gl_list_get_at (list, 0);
690 }
691
692 GL_LIST_INLINE const void *
693 gl_list_get_last (gl_list_t list)
694 {
695 return gl_list_get_at (list, gl_list_size (list) - 1);
696 }
697
698 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
699 gl_list_nx_set_at (gl_list_t list, size_t position, const void *elt)
700 {
701 return ((const struct gl_list_impl_base *) list)->vtable
702 ->nx_set_at (list, position, elt);
703 }
704
705 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
706 gl_list_nx_set_first (gl_list_t list, const void *elt)
707 {
708 return gl_list_nx_set_at (list, 0, elt);
709 }
710
711 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
712 gl_list_nx_set_last (gl_list_t list, const void *elt)
713 {
714 return gl_list_nx_set_at (list, gl_list_size (list) - 1, elt);
715 }
716
717 GL_LIST_INLINE gl_list_node_t
718 gl_list_search (gl_list_t list, const void *elt)
719 {
720 size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
721 return ((const struct gl_list_impl_base *) list)->vtable
722 ->search_from_to (list, 0, size, elt);
723 }
724
725 GL_LIST_INLINE gl_list_node_t
726 gl_list_search_from (gl_list_t list, size_t start_index, const void *elt)
727 {
728 size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
729 return ((const struct gl_list_impl_base *) list)->vtable
730 ->search_from_to (list, start_index, size, elt);
731 }
732
733 GL_LIST_INLINE gl_list_node_t
734 gl_list_search_from_to (gl_list_t list, size_t start_index, size_t end_index,
735 const void *elt)
736 {
737 return ((const struct gl_list_impl_base *) list)->vtable
738 ->search_from_to (list, start_index, end_index, elt);
739 }
740
741 GL_LIST_INLINE size_t
742 gl_list_indexof (gl_list_t list, const void *elt)
743 {
744 size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
745 return ((const struct gl_list_impl_base *) list)->vtable
746 ->indexof_from_to (list, 0, size, elt);
747 }
748
749 GL_LIST_INLINE size_t
750 gl_list_indexof_from (gl_list_t list, size_t start_index, const void *elt)
751 {
752 size_t size = ((const struct gl_list_impl_base *) list)->vtable->size (list);
753 return ((const struct gl_list_impl_base *) list)->vtable
754 ->indexof_from_to (list, start_index, size, elt);
755 }
756
757 GL_LIST_INLINE size_t
758 gl_list_indexof_from_to (gl_list_t list, size_t start_index, size_t end_index,
759 const void *elt)
760 {
761 return ((const struct gl_list_impl_base *) list)->vtable
762 ->indexof_from_to (list, start_index, end_index, elt);
763 }
764
765 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
766 gl_list_nx_add_first (gl_list_t list, const void *elt)
767 {
768 return ((const struct gl_list_impl_base *) list)->vtable
769 ->nx_add_first (list, elt);
770 }
771
772 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
773 gl_list_nx_add_last (gl_list_t list, const void *elt)
774 {
775 return ((const struct gl_list_impl_base *) list)->vtable
776 ->nx_add_last (list, elt);
777 }
778
779 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
780 gl_list_nx_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
781 {
782 return ((const struct gl_list_impl_base *) list)->vtable
783 ->nx_add_before (list, node, elt);
784 }
785
786 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
787 gl_list_nx_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
788 {
789 return ((const struct gl_list_impl_base *) list)->vtable
790 ->nx_add_after (list, node, elt);
791 }
792
793 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
794 gl_list_nx_add_at (gl_list_t list, size_t position, const void *elt)
795 {
796 return ((const struct gl_list_impl_base *) list)->vtable
797 ->nx_add_at (list, position, elt);
798 }
799
800 GL_LIST_INLINE bool
801 gl_list_remove_node (gl_list_t list, gl_list_node_t node)
802 {
803 return ((const struct gl_list_impl_base *) list)->vtable
804 ->remove_node (list, node);
805 }
806
807 GL_LIST_INLINE bool
808 gl_list_remove_at (gl_list_t list, size_t position)
809 {
810 return ((const struct gl_list_impl_base *) list)->vtable
811 ->remove_at (list, position);
812 }
813
814 GL_LIST_INLINE bool
815 gl_list_remove_first (gl_list_t list)
816 {
817 size_t size = gl_list_size (list);
818 if (size > 0)
819 return gl_list_remove_at (list, 0);
820 else
821 return false;
822 }
823
824 GL_LIST_INLINE bool
825 gl_list_remove_last (gl_list_t list)
826 {
827 size_t size = gl_list_size (list);
828 if (size > 0)
829 return gl_list_remove_at (list, size - 1);
830 else
831 return false;
832 }
833
834 GL_LIST_INLINE bool
835 gl_list_remove (gl_list_t list, const void *elt)
836 {
837 return ((const struct gl_list_impl_base *) list)->vtable
838 ->remove_elt (list, elt);
839 }
840
841 GL_LIST_INLINE void
842 gl_list_free (gl_list_t list)
843 {
844 ((const struct gl_list_impl_base *) list)->vtable->list_free (list);
845 }
846
847 GL_LIST_INLINE gl_list_iterator_t
848 gl_list_iterator (gl_list_t list)
849 {
850 return ((const struct gl_list_impl_base *) list)->vtable
851 ->iterator (list);
852 }
853
854 GL_LIST_INLINE gl_list_iterator_t
855 gl_list_iterator_from_to (gl_list_t list, size_t start_index, size_t end_index)
856 {
857 return ((const struct gl_list_impl_base *) list)->vtable
858 ->iterator_from_to (list, start_index, end_index);
859 }
860
861 GL_LIST_INLINE bool
862 gl_list_iterator_next (gl_list_iterator_t *iterator,
863 const void **eltp, gl_list_node_t *nodep)
864 {
865 return iterator->vtable->iterator_next (iterator, eltp, nodep);
866 }
867
868 GL_LIST_INLINE void
869 gl_list_iterator_free (gl_list_iterator_t *iterator)
870 {
871 iterator->vtable->iterator_free (iterator);
872 }
873
874 GL_LIST_INLINE gl_list_node_t
875 gl_sortedlist_search (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
876 {
877 return ((const struct gl_list_impl_base *) list)->vtable
878 ->sortedlist_search (list, compar, elt);
879 }
880
881 GL_LIST_INLINE gl_list_node_t
882 gl_sortedlist_search_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt)
883 {
884 return ((const struct gl_list_impl_base *) list)->vtable
885 ->sortedlist_search_from_to (list, compar, start_index, end_index,
886 elt);
887 }
888
889 GL_LIST_INLINE size_t
890 gl_sortedlist_indexof (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
891 {
892 return ((const struct gl_list_impl_base *) list)->vtable
893 ->sortedlist_indexof (list, compar, elt);
894 }
895
896 GL_LIST_INLINE size_t
897 gl_sortedlist_indexof_from_to (gl_list_t list, gl_listelement_compar_fn compar, size_t start_index, size_t end_index, const void *elt)
898 {
899 return ((const struct gl_list_impl_base *) list)->vtable
900 ->sortedlist_indexof_from_to (list, compar, start_index, end_index,
901 elt);
902 }
903
904 _GL_ATTRIBUTE_NODISCARD GL_LIST_INLINE gl_list_node_t
905 gl_sortedlist_nx_add (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
906 {
907 return ((const struct gl_list_impl_base *) list)->vtable
908 ->sortedlist_nx_add (list, compar, elt);
909 }
910
911 GL_LIST_INLINE bool
912 gl_sortedlist_remove (gl_list_t list, gl_listelement_compar_fn compar, const void *elt)
913 {
914 return ((const struct gl_list_impl_base *) list)->vtable
915 ->sortedlist_remove (list, compar, elt);
916 }
917
918 #ifdef __cplusplus
919 }
920 #endif
921
922 _GL_INLINE_HEADER_END
923
924 #endif