aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2011-05-19 18:13:38 +0200
committerTobias Brunner <tobias@strongswan.org>2011-07-06 09:43:45 +0200
commit67405ce808ad02b5d8b7a30cef8e87b839c299cf (patch)
tree7d354c0e37356e1fce6c7bfadae5be64b222e6bd /src
parent572abc6cbd7dde102498fa47e43e7676cba05748 (diff)
downloadstrongswan-67405ce808ad02b5d8b7a30cef8e87b839c299cf.tar.bz2
strongswan-67405ce808ad02b5d8b7a30cef8e87b839c299cf.tar.xz
Added a function to reset the enumerator of a linked list.
Diffstat (limited to 'src')
-rw-r--r--src/libstrongswan/utils/linked_list.c7
-rw-r--r--src/libstrongswan/utils/linked_list.h7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/linked_list.c b/src/libstrongswan/utils/linked_list.c
index a44bcc13e..67cb821e0 100644
--- a/src/libstrongswan/utils/linked_list.c
+++ b/src/libstrongswan/utils/linked_list.c
@@ -175,6 +175,12 @@ METHOD(linked_list_t, create_enumerator, enumerator_t*,
return &enumerator->enumerator;
}
+METHOD(linked_list_t, reset_enumerator, void,
+ private_linked_list_t *this, private_enumerator_t *enumerator)
+{
+ enumerator->current = NULL;
+}
+
METHOD(iterator_t, iterator_get_count, int,
private_iterator_t *this)
{
@@ -727,6 +733,7 @@ linked_list_t *linked_list_create()
.get_count = _get_count,
.create_iterator = _create_iterator,
.create_enumerator = _create_enumerator,
+ .reset_enumerator = (void*)_reset_enumerator,
.get_first = _get_first,
.get_last = _get_last,
.find_first = (void*)_find_first,
diff --git a/src/libstrongswan/utils/linked_list.h b/src/libstrongswan/utils/linked_list.h
index 85804270d..9d4267ea5 100644
--- a/src/libstrongswan/utils/linked_list.h
+++ b/src/libstrongswan/utils/linked_list.h
@@ -85,6 +85,13 @@ struct linked_list_t {
enumerator_t* (*create_enumerator)(linked_list_t *this);
/**
+ * Resets the enumerator's current position to the beginning of the list.
+ *
+ * @param enumerator enumerator to reset
+ */
+ void (*reset_enumerator)(linked_list_t *this, enumerator_t *enumerator);
+
+ /**
* Inserts a new item at the beginning of the list.
*
* @param item item value to insert in list