diff options
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r-- | src/include/gnunet_container_lib.h | 35 |
1 files changed, 28 insertions, 7 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h index 8abf10e21..b63ced75b 100644 --- a/src/include/gnunet_container_lib.h +++ b/src/include/gnunet_container_lib.h | |||
@@ -876,10 +876,14 @@ GNUNET_CONTAINER_heap_get_size (struct GNUNET_CONTAINER_Heap *heap); | |||
876 | 876 | ||
877 | /* ******************** Singly linked list *************** */ | 877 | /* ******************** Singly linked list *************** */ |
878 | 878 | ||
879 | /* Handle to a singly linked list */ | 879 | /** |
880 | * Handle to a singly linked list | ||
881 | */ | ||
880 | struct GNUNET_CONTAINER_SList; | 882 | struct GNUNET_CONTAINER_SList; |
881 | 883 | ||
882 | /* Handle to a singly linked list iterator */ | 884 | /** |
885 | * Handle to a singly linked list iterator | ||
886 | */ | ||
883 | struct GNUNET_CONTAINER_SList_Iterator; | 887 | struct GNUNET_CONTAINER_SList_Iterator; |
884 | 888 | ||
885 | 889 | ||
@@ -892,11 +896,13 @@ struct GNUNET_CONTAINER_SList_Iterator; | |||
892 | */ | 896 | */ |
893 | void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, int disp, const void *buf, size_t len); | 897 | void GNUNET_CONTAINER_slist_add (struct GNUNET_CONTAINER_SList *l, int disp, const void *buf, size_t len); |
894 | 898 | ||
899 | |||
895 | /** | 900 | /** |
896 | * Create a new singly linked list | 901 | * Create a new singly linked list |
897 | * @return the new list | 902 | * @return the new list |
898 | */ | 903 | */ |
899 | struct GNUNET_CONTAINER_SList *GNUNET_CONTAINER_slist_create (); | 904 | struct GNUNET_CONTAINER_SList *GNUNET_CONTAINER_slist_create (void); |
905 | |||
900 | 906 | ||
901 | /** | 907 | /** |
902 | * Destroy a singly linked list | 908 | * Destroy a singly linked list |
@@ -904,19 +910,25 @@ struct GNUNET_CONTAINER_SList *GNUNET_CONTAINER_slist_create (); | |||
904 | */ | 910 | */ |
905 | void GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l); | 911 | void GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l); |
906 | 912 | ||
913 | |||
907 | /** | 914 | /** |
908 | * Return the beginning of a list | 915 | * Return the beginning of a list |
916 | * | ||
909 | * @param l list | 917 | * @param l list |
910 | * @return iterator pointing to the beginning | 918 | * @return iterator pointing to the beginning, free using "GNUNET_free" |
911 | */ | 919 | */ |
912 | const struct GNUNET_CONTAINER_SList_Iterator *GNUNET_CONTAINER_slist_begin(const struct GNUNET_CONTAINER_SList *l); | 920 | struct GNUNET_CONTAINER_SList_Iterator * |
921 | GNUNET_CONTAINER_slist_begin(struct GNUNET_CONTAINER_SList *l); | ||
922 | |||
913 | 923 | ||
914 | /** | 924 | /** |
915 | * Clear a list | 925 | * Clear a list |
926 | * | ||
916 | * @param l list | 927 | * @param l list |
917 | */ | 928 | */ |
918 | void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l); | 929 | void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l); |
919 | 930 | ||
931 | |||
920 | /** | 932 | /** |
921 | * Check if a list contains a certain element | 933 | * Check if a list contains a certain element |
922 | * @param l list | 934 | * @param l list |
@@ -925,6 +937,7 @@ void GNUNET_CONTAINER_slist_clear (struct GNUNET_CONTAINER_SList *l); | |||
925 | */ | 937 | */ |
926 | int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, const void *buf, size_t len); | 938 | int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, const void *buf, size_t len); |
927 | 939 | ||
940 | |||
928 | /** | 941 | /** |
929 | * Count the elements of a list | 942 | * Count the elements of a list |
930 | * @param l list | 943 | * @param l list |
@@ -932,12 +945,14 @@ int GNUNET_CONTAINER_slist_contains (const struct GNUNET_CONTAINER_SList *l, con | |||
932 | */ | 945 | */ |
933 | int GNUNET_CONTAINER_slist_count (const struct GNUNET_CONTAINER_SList *l); | 946 | int GNUNET_CONTAINER_slist_count (const struct GNUNET_CONTAINER_SList *l); |
934 | 947 | ||
948 | |||
935 | /** | 949 | /** |
936 | * Remove an element from the list | 950 | * Remove an element from the list |
937 | * @param i iterator that points to the element to be removed | 951 | * @param i iterator that points to the element to be removed |
938 | */ | 952 | */ |
939 | void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i); | 953 | void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i); |
940 | 954 | ||
955 | |||
941 | /** | 956 | /** |
942 | * Insert an element into a list at a specific position | 957 | * Insert an element into a list at a specific position |
943 | * @param before where to insert the new element | 958 | * @param before where to insert the new element |
@@ -947,6 +962,7 @@ void GNUNET_CONTAINER_slist_erase (struct GNUNET_CONTAINER_SList_Iterator *i); | |||
947 | */ | 962 | */ |
948 | void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *before, int disp, const void *buf, size_t len); | 963 | void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *before, int disp, const void *buf, size_t len); |
949 | 964 | ||
965 | |||
950 | /** | 966 | /** |
951 | * Advance an iterator to the next element | 967 | * Advance an iterator to the next element |
952 | * @param i iterator | 968 | * @param i iterator |
@@ -954,6 +970,7 @@ void GNUNET_CONTAINER_slist_insert (struct GNUNET_CONTAINER_SList_Iterator *befo | |||
954 | */ | 970 | */ |
955 | int GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i); | 971 | int GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i); |
956 | 972 | ||
973 | |||
957 | /** | 974 | /** |
958 | * Check if an iterator points beyond the end of a list | 975 | * Check if an iterator points beyond the end of a list |
959 | * @param i iterator | 976 | * @param i iterator |
@@ -962,13 +979,17 @@ int GNUNET_CONTAINER_slist_next (struct GNUNET_CONTAINER_SList_Iterator *i); | |||
962 | */ | 979 | */ |
963 | int GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i); | 980 | int GNUNET_CONTAINER_slist_end (struct GNUNET_CONTAINER_SList_Iterator *i); |
964 | 981 | ||
982 | |||
965 | /** | 983 | /** |
966 | * Retrieve the element at a specific position in a list | 984 | * Retrieve the element at a specific position in a list |
985 | * | ||
967 | * @param i iterator | 986 | * @param i iterator |
968 | * @param len payload length | 987 | * @param len set to the payload length |
969 | * @return payload | 988 | * @return payload |
970 | */ | 989 | */ |
971 | void *GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator *i, size_t *len); | 990 | const void * |
991 | GNUNET_CONTAINER_slist_get (const struct GNUNET_CONTAINER_SList_Iterator *i, | ||
992 | size_t *len); | ||
972 | 993 | ||
973 | 994 | ||
974 | #if 0 /* keep Emacsens' auto-indent happy */ | 995 | #if 0 /* keep Emacsens' auto-indent happy */ |