aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_container_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-14 07:22:42 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-14 07:22:42 +0000
commit662b5736c37e8cf2b3e6aa5af53cef0d03b743ab (patch)
treec4299637a2db19a3e87957645d5aa58e196da43f /src/include/gnunet_container_lib.h
parent94aa63cb17777332095a1de0a70382a49e10fecb (diff)
downloadgnunet-662b5736c37e8cf2b3e6aa5af53cef0d03b743ab.tar.gz
gnunet-662b5736c37e8cf2b3e6aa5af53cef0d03b743ab.zip
LRN loves slist: Use stack allocation for slist iterator
Diffstat (limited to 'src/include/gnunet_container_lib.h')
-rw-r--r--src/include/gnunet_container_lib.h25
1 files changed, 22 insertions, 3 deletions
diff --git a/src/include/gnunet_container_lib.h b/src/include/gnunet_container_lib.h
index 0c7f60a7a..75443b6ae 100644
--- a/src/include/gnunet_container_lib.h
+++ b/src/include/gnunet_container_lib.h
@@ -1054,7 +1054,24 @@ struct GNUNET_CONTAINER_SList;
1054/** 1054/**
1055 * Handle to a singly linked list iterator 1055 * Handle to a singly linked list iterator
1056 */ 1056 */
1057struct GNUNET_CONTAINER_SList_Iterator; 1057struct GNUNET_CONTAINER_SList_Iterator
1058{
1059 /**
1060 * Linked list that we are iterating over.
1061 */
1062 struct GNUNET_CONTAINER_SList *list;
1063
1064 /**
1065 * Last element accessed.
1066 */
1067 struct GNUNET_CONTAINER_SList_Elem *last;
1068
1069 /**
1070 * Current list element.
1071 */
1072 struct GNUNET_CONTAINER_SList_Elem *elem;
1073};
1074
1058 1075
1059 1076
1060/** 1077/**
@@ -1113,9 +1130,11 @@ GNUNET_CONTAINER_slist_destroy (struct GNUNET_CONTAINER_SList *l);
1113 * Return the beginning of a list 1130 * Return the beginning of a list
1114 * 1131 *
1115 * @param l list 1132 * @param l list
1116 * @return iterator pointing to the beginning, free using "GNUNET_free" 1133 * @return iterator pointing to the beginning (by value! Either allocate the
1134 * structure on the stack, or use GNUNET_malloc() yourself! All other
1135 * functions do take pointer to this struct though)
1117 */ 1136 */
1118struct GNUNET_CONTAINER_SList_Iterator * 1137struct GNUNET_CONTAINER_SList_Iterator
1119GNUNET_CONTAINER_slist_begin (struct GNUNET_CONTAINER_SList *l); 1138GNUNET_CONTAINER_slist_begin (struct GNUNET_CONTAINER_SList *l);
1120 1139
1121 1140