aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/eina/src/include/eina_inlist.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/eina/src/include/eina_inlist.h')
-rw-r--r--libraries/eina/src/include/eina_inlist.h101
1 files changed, 51 insertions, 50 deletions
diff --git a/libraries/eina/src/include/eina_inlist.h b/libraries/eina/src/include/eina_inlist.h
index 1b3ab27..cfb3159 100644
--- a/libraries/eina/src/include/eina_inlist.h
+++ b/libraries/eina/src/include/eina_inlist.h
@@ -25,7 +25,7 @@
25#include <stddef.h> 25#include <stddef.h>
26 26
27/** 27/**
28 * @page inlist_01_example_page Eina_Inlist basic usage 28 * @page eina_inlist_01_example_page Eina_Inlist basic usage
29 * @dontinclude eina_inlist_01.c 29 * @dontinclude eina_inlist_01.c
30 * 30 *
31 * To see the full source for this example, click here: @ref 31 * To see the full source for this example, click here: @ref
@@ -111,7 +111,7 @@
111 */ 111 */
112 112
113/** 113/**
114 * @page inlist_02_example_page Eina_Inlist advanced usage - lists and inlists 114 * @page eina_inlist_02_example_page Eina_Inlist advanced usage - lists and inlists
115 * @dontinclude eina_inlist_02.c 115 * @dontinclude eina_inlist_02.c
116 * 116 *
117 * This example describes the usage of @ref Eina_Inlist mixed with @ref 117 * This example describes the usage of @ref Eina_Inlist mixed with @ref
@@ -120,7 +120,7 @@
120 * from this normal list. 120 * from this normal list.
121 * 121 *
122 * The struct that is going to be used is the same used in @ref 122 * The struct that is going to be used is the same used in @ref
123 * inlist_01_example_page , since we still need the @ref EINA_INLIST macro to 123 * eina_inlist_01_example_page , since we still need the @ref EINA_INLIST macro to
124 * declare the inlist node info: 124 * declare the inlist node info:
125 * 125 *
126 * @skip struct 126 * @skip struct
@@ -184,7 +184,7 @@
184 */ 184 */
185 185
186/** 186/**
187 * @page inlist_03_example_page Eina_Inlist advanced usage - multi-inlists 187 * @page eina_inlist_03_example_page Eina_Inlist advanced usage - multi-inlists
188 * @dontinclude eina_inlist_03.c 188 * @dontinclude eina_inlist_03.c
189 * 189 *
190 * This example describes the usage of multiple inlists storing the same data. 190 * This example describes the usage of multiple inlists storing the same data.
@@ -315,7 +315,7 @@
315 * exactly what type this list is. 315 * exactly what type this list is.
316 * 316 *
317 * A simple example demonstrating the basic usage of an inlist can be found 317 * A simple example demonstrating the basic usage of an inlist can be found
318 * here: @ref inlist_01_example_page 318 * here: @ref eina_inlist_01_example_page
319 * 319 *
320 * @section inlist_algo Algorithm 320 * @section inlist_algo Algorithm
321 * 321 *
@@ -368,9 +368,9 @@
368 * @ref inlist_03_example_page 368 * @ref inlist_03_example_page
369 * 369 *
370 * List of examples: 370 * List of examples:
371 * @li @ref inlist_01_example_page 371 * @li @ref eina_inlist_01_example_page
372 * @li @ref inlist_02_example_page 372 * @li @ref eina_inlist_02_example_page
373 * @li @ref inlist_03_example_page 373 * @li @ref eina_inlist_03_example_page
374 */ 374 */
375 375
376/** 376/**
@@ -428,17 +428,17 @@ struct _Eina_Inlist
428 * Add a new node to end of a list. 428 * Add a new node to end of a list.
429 * 429 *
430 * @note this code is meant to be fast: appends are O(1) and do not 430 * @note this code is meant to be fast: appends are O(1) and do not
431 * walk @a list. 431 * walk @a in_list.
432 * 432 *
433 * @note @a new_l is considered to be in no list. If it was in another 433 * @note @a in_item is considered to be in no list. If it was in another
434 * list before, eina_inlist_remove() it before adding. No 434 * list before, eina_inlist_remove() it before adding. No
435 * check of @a new_l prev and next pointers is done, so it's safe 435 * check of @a new_l prev and next pointers is done, so it's safe
436 * to have them uninitialized. 436 * to have them uninitialized.
437 * 437 *
438 * @param list existing list head or NULL to create a new list. 438 * @param in_list existing list head or NULL to create a new list.
439 * @param new_l new list node, must not be NULL. 439 * @param in_item new list node, must not be NULL.
440 * 440 *
441 * @return the new list head. Use it and not @a list anymore. 441 * @return the new list head. Use it and not @a in_list anymore.
442 */ 442 */
443EAPI Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list, 443EAPI Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list,
444 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; 444 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@@ -447,17 +447,17 @@ EAPI Eina_Inlist *eina_inlist_append(Eina_Inlist *in_list,
447 * Add a new node to beginning of list. 447 * Add a new node to beginning of list.
448 * 448 *
449 * @note this code is meant to be fast: appends are O(1) and do not 449 * @note this code is meant to be fast: appends are O(1) and do not
450 * walk @a list. 450 * walk @a in_list.
451 * 451 *
452 * @note @a new_l is considered to be in no list. If it was in another 452 * @note @a new_l is considered to be in no list. If it was in another
453 * list before, eina_inlist_remove() it before adding. No 453 * list before, eina_inlist_remove() it before adding. No
454 * check of @a new_l prev and next pointers is done, so it's safe 454 * check of @a new_l prev and next pointers is done, so it's safe
455 * to have them uninitialized. 455 * to have them uninitialized.
456 * 456 *
457 * @param list existing list head or NULL to create a new list. 457 * @param in_list existing list head or NULL to create a new list.
458 * @param new_l new list node, must not be NULL. 458 * @param in_item new list node, must not be NULL.
459 * 459 *
460 * @return the new list head. Use it and not @a list anymore. 460 * @return the new list head. Use it and not @a in_list anymore.
461 */ 461 */
462EAPI Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list, 462EAPI Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list,
463 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; 463 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@@ -466,21 +466,21 @@ EAPI Eina_Inlist *eina_inlist_prepend(Eina_Inlist *in_list,
466 * Add a new node after the given relative item in list. 466 * Add a new node after the given relative item in list.
467 * 467 *
468 * @note this code is meant to be fast: appends are O(1) and do not 468 * @note this code is meant to be fast: appends are O(1) and do not
469 * walk @a list. 469 * walk @a in_list.
470 * 470 *
471 * @note @a new_l is considered to be in no list. If it was in another 471 * @note @a in_item_l is considered to be in no list. If it was in another
472 * list before, eina_inlist_remove() it before adding. No 472 * list before, eina_inlist_remove() it before adding. No
473 * check of @a new_l prev and next pointers is done, so it's safe 473 * check of @a in_item prev and next pointers is done, so it's safe
474 * to have them uninitialized. 474 * to have them uninitialized.
475 * 475 *
476 * @note @a relative is considered to be inside @a list, no checks are 476 * @note @a in_relative is considered to be inside @a in_list, no checks are
477 * done to confirm that and giving nodes from different lists 477 * done to confirm that and giving nodes from different lists
478 * will lead to problems. Giving NULL @a relative is the same as 478 * will lead to problems. Giving NULL @a in_relative is the same as
479 * eina_list_append(). 479 * eina_list_append().
480 * 480 *
481 * @param list existing list head or NULL to create a new list. 481 * @param in_list existing list head or NULL to create a new list.
482 * @param new_l new list node, must not be NULL. 482 * @param in_item new list node, must not be NULL.
483 * @param relative reference node, @a new_l will be added after it. 483 * @param in_relative reference node, @a in_item will be added after it.
484 * 484 *
485 * @return the new list head. Use it and not @a list anymore. 485 * @return the new list head. Use it and not @a list anymore.
486 */ 486 */
@@ -492,23 +492,23 @@ EAPI Eina_Inlist *eina_inlist_append_relative(Eina_Inlist *in_list,
492 * Add a new node before the given relative item in list. 492 * Add a new node before the given relative item in list.
493 * 493 *
494 * @note this code is meant to be fast: appends are O(1) and do not 494 * @note this code is meant to be fast: appends are O(1) and do not
495 * walk @a list. 495 * walk @a in_list.
496 * 496 *
497 * @note @a new_l is considered to be in no list. If it was in another 497 * @note @a in_item is considered to be in no list. If it was in another
498 * list before, eina_inlist_remove() it before adding. No 498 * list before, eina_inlist_remove() it before adding. No
499 * check of @a new_l prev and next pointers is done, so it's safe 499 * check of @a in_item prev and next pointers is done, so it's safe
500 * to have them uninitialized. 500 * to have them uninitialized.
501 * 501 *
502 * @note @a relative is considered to be inside @a list, no checks are 502 * @note @a in_relative is considered to be inside @a in_list, no checks are
503 * done to confirm that and giving nodes from different lists 503 * done to confirm that and giving nodes from different lists
504 * will lead to problems. Giving NULL @a relative is the same as 504 * will lead to problems. Giving NULL @a in_relative is the same as
505 * eina_list_prepend(). 505 * eina_list_prepend().
506 * 506 *
507 * @param list existing list head or NULL to create a new list. 507 * @param in_list existing list head or NULL to create a new list.
508 * @param new_l new list node, must not be NULL. 508 * @param in_item new list node, must not be NULL.
509 * @param relative reference node, @a new_l will be added before it. 509 * @param in_relative reference node, @a in_item will be added before it.
510 * 510 *
511 * @return the new list head. Use it and not @a list anymore. 511 * @return the new list head. Use it and not @a in_list anymore.
512 */ 512 */
513EAPI Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list, 513EAPI Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list,
514 Eina_Inlist *in_item, 514 Eina_Inlist *in_item,
@@ -520,14 +520,14 @@ EAPI Eina_Inlist *eina_inlist_prepend_relative(Eina_Inlist *in_list,
520 * @note this code is meant to be fast: appends are O(1) and do not 520 * @note this code is meant to be fast: appends are O(1) and do not
521 * walk @a list. 521 * walk @a list.
522 * 522 *
523 * @note @a item is considered to be inside @a list, no checks are 523 * @note @a in_item is considered to be inside @a in_list, no checks are
524 * done to confirm that and giving nodes from different lists 524 * done to confirm that and giving nodes from different lists
525 * will lead to problems, especially if @a item is the head since 525 * will lead to problems, especially if @a in_item is the head since
526 * it will be different from @a list and the wrong new head will 526 * it will be different from @a list and the wrong new head will
527 * be returned. 527 * be returned.
528 * 528 *
529 * @param list existing list head, must not be NULL. 529 * @param in_list existing list head, must not be NULL.
530 * @param item existing list node, must not be NULL. 530 * @param in_item existing list node, must not be NULL.
531 * 531 *
532 * @return the new list head. Use it and not @a list anymore. 532 * @return the new list head. Use it and not @a list anymore.
533 */ 533 */
@@ -540,10 +540,10 @@ EAPI Eina_Inlist *eina_inlist_remove(Eina_Inlist *in_list,
540 * @warning this is an expensive call and has O(n) cost, possibly 540 * @warning this is an expensive call and has O(n) cost, possibly
541 * walking the whole list. 541 * walking the whole list.
542 * 542 *
543 * @param list existing list to search @a item in, must not be NULL. 543 * @param in_list existing list to search @a in_item in, must not be NULL.
544 * @param item what to search for, must not be NULL. 544 * @param in_item what to search for, must not be NULL.
545 * 545 *
546 * @return @a item if found, NULL if not. 546 * @return @a in_item if found, NULL if not.
547 */ 547 */
548EAPI Eina_Inlist *eina_inlist_find(Eina_Inlist *in_list, 548EAPI Eina_Inlist *eina_inlist_find(Eina_Inlist *in_list,
549 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT; 549 Eina_Inlist *in_item) EINA_ARG_NONNULL(2) EINA_WARN_UNUSED_RESULT;
@@ -603,11 +603,11 @@ EAPI unsigned int eina_inlist_count(const Eina_Inlist *list) EINA_WARN_UNUSED_
603/** 603/**
604 * @brief Returns a new iterator associated to @a list. 604 * @brief Returns a new iterator associated to @a list.
605 * 605 *
606 * @param list The list. 606 * @param in_list The list.
607 * @return A new iterator. 607 * @return A new iterator.
608 * 608 *
609 * This function returns a newly allocated iterator associated to @p 609 * This function returns a newly allocated iterator associated to @p
610 * list. If @p list is @c NULL or the count member of @p list is less 610 * in_list. If @p in_list is @c NULL or the count member of @p in_list is less
611 * or equal than 0, this function still returns a valid iterator that 611 * or equal than 0, this function still returns a valid iterator that
612 * will always return false on eina_iterator_next(), thus keeping API 612 * will always return false on eina_iterator_next(), thus keeping API
613 * sane. 613 * sane.
@@ -625,13 +625,13 @@ EAPI Eina_Iterator *eina_inlist_iterator_new(const Eina_Inlist *in_list) EINA_MA
625/** 625/**
626 * @brief Returns a new accessor associated to a list. 626 * @brief Returns a new accessor associated to a list.
627 * 627 *
628 * @param list The list. 628 * @param in_list The list.
629 * @return A new accessor. 629 * @return A new accessor.
630 * 630 *
631 * This function returns a newly allocated accessor associated to 631 * This function returns a newly allocated accessor associated to
632 * @p list. If @p list is @c NULL or the count member of @p list is 632 * @p in_list. If @p in_list is @c NULL or the count member of @p in_list is
633 * less or equal than 0, this function returns NULL. If the memory can 633 * less or equal than 0, this function returns @c NULL. If the memory can
634 * not be allocated, NULL is returned and #EINA_ERROR_OUT_OF_MEMORY is 634 * not be allocated, @c NULL is returned and #EINA_ERROR_OUT_OF_MEMORY is
635 * set. Otherwise, a valid accessor is returned. 635 * set. Otherwise, a valid accessor is returned.
636 */ 636 */
637EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT; 637EAPI Eina_Accessor *eina_inlist_accessor_new(const Eina_Inlist *in_list) EINA_MALLOC EINA_WARN_UNUSED_RESULT;
@@ -728,13 +728,13 @@ EAPI Eina_Inlist *eina_inlist_sorted_state_insert(Eina_Inlist *list,
728/** 728/**
729 * @brief Sort a list according to the ordering func will return. 729 * @brief Sort a list according to the ordering func will return.
730 * 730 *
731 * @param list The list handle to sort. 731 * @param head The list handle to sort.
732 * @param func A function pointer that can handle comparing the list data 732 * @param func A function pointer that can handle comparing the list data
733 * nodes. 733 * nodes.
734 * @return the new head of list. 734 * @return the new head of list.
735 * 735 *
736 * This function sorts all the elements of @p list. @p func is used to 736 * This function sorts all the elements of @p head. @p func is used to
737 * compare two elements of @p list. If @p list or @p func are @c NULL, 737 * compare two elements of @p head. If @p head or @p func are @c NULL,
738 * this function returns @c NULL. 738 * this function returns @c NULL.
739 * 739 *
740 * @note @b in-place: this will change the given list, so you should 740 * @note @b in-place: this will change the given list, so you should
@@ -787,6 +787,7 @@ EAPI Eina_Inlist *eina_inlist_sort(Eina_Inlist *head, Eina_Compare_Cb func);
787 _EINA_INLIST_OFFSET(ref)) 787 _EINA_INLIST_OFFSET(ref))
788#endif 788#endif
789 789
790/** Macro to iterate over an inlist */
790#define EINA_INLIST_FOREACH(list, l) \ 791#define EINA_INLIST_FOREACH(list, l) \
791 for (l = NULL, l = (list ? _EINA_INLIST_CONTAINER(l, list) : NULL); l; \ 792 for (l = NULL, l = (list ? _EINA_INLIST_CONTAINER(l, list) : NULL); l; \
792 l = (EINA_INLIST_GET(l)->next ? _EINA_INLIST_CONTAINER(l, EINA_INLIST_GET(l)->next) : NULL)) 793 l = (EINA_INLIST_GET(l)->next ? _EINA_INLIST_CONTAINER(l, EINA_INLIST_GET(l)->next) : NULL))