aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan')
-rw-r--r--src/libstrongswan/Makefile.am8
-rw-r--r--src/libstrongswan/utils/linked_list.c6
-rw-r--r--src/libstrongswan/utils/linked_list.h10
3 files changed, 15 insertions, 9 deletions
diff --git a/src/libstrongswan/Makefile.am b/src/libstrongswan/Makefile.am
index 08409d503..014509b99 100644
--- a/src/libstrongswan/Makefile.am
+++ b/src/libstrongswan/Makefile.am
@@ -72,11 +72,11 @@ EXTRA_DIST = asn1/oid.txt asn1/oid.pl
BUILT_SOURCES = asn1/oid.c asn1/oid.h
MAINTAINERCLEANFILES = asn1/oid.c asn1/oid.h
-asn1/oid.c : asn1/oid.txt asn1/oid.pl
- cd asn1 && $(PERL) oid.pl
+asn1/oid.c : asn1/oid.pl asn1/oid.txt
+ (cd `dirname $<` && $(PERL) $<)
-asn1/oid.h : asn1/oid.txt asn1/oid.pl
- cd asn1 && $(PERL) oid.pl
+asn1/oid.h : asn1/oid.pl asn1/oid.txt
+ (cd `dirname $<` && $(PERL) $<)
# build plugins with their own Makefile
diff --git a/src/libstrongswan/utils/linked_list.c b/src/libstrongswan/utils/linked_list.c
index cd755c4c0..9508e9ae7 100644
--- a/src/libstrongswan/utils/linked_list.c
+++ b/src/libstrongswan/utils/linked_list.c
@@ -632,7 +632,8 @@ static status_t find_first(private_linked_list_t *this, linked_list_match_t matc
while (current)
{
- if (match(current->value, d1, d2, d3, d4, d5))
+ if ((match && match(current->value, d1, d2, d3, d4, d5)) ||
+ (!match && item && current->value == *item))
{
if (item != NULL)
{
@@ -655,7 +656,8 @@ static status_t find_last(private_linked_list_t *this, linked_list_match_t match
while (current)
{
- if (match(current->value, d1, d2, d3, d4, d5))
+ if ((match && match(current->value, d1, d2, d3, d4, d5)) ||
+ (!match && item && current->value == *item))
{
if (item != NULL)
{
diff --git a/src/libstrongswan/utils/linked_list.h b/src/libstrongswan/utils/linked_list.h
index 214558c01..183f93f96 100644
--- a/src/libstrongswan/utils/linked_list.h
+++ b/src/libstrongswan/utils/linked_list.h
@@ -130,7 +130,7 @@ struct linked_list_t {
* If a compare function is given, it is called for each item, where
* the first parameter is the current list item and the second parameter
* is the supplied item parameter.
- * If compare is NULL, compare is is done by pointer.
+ * If compare is NULL, compare is done by pointer.
*
* @param item item to remove/pass to comparator
* @param compare compare function, or NULL
@@ -179,10 +179,12 @@ struct linked_list_t {
* If the supplied function returns TRUE this function returns SUCCESS, and
* the current object is returned in the third parameter, otherwise,
* the next item is checked.
+ *
+ * If match is NULL, *item and the current object are compared.
*
* @warning Only use pointers as user supplied data.
*
- * @param match comparison function to call on each object
+ * @param match comparison function to call on each object, or NULL
* @param item the list item, if found
* @param ... user data to supply to match function (limited to 5 arguments)
* @return SUCCESS if found, NOT_FOUND otherwise
@@ -198,9 +200,11 @@ struct linked_list_t {
* the current object is returned in the third parameter, otherwise,
* the next item is checked.
*
+ * If match is NULL, *item and the current object are compared.
+ *
* @warning Only use pointers as user supplied data.
*
- * @param match comparison function to call on each object
+ * @param match comparison function to call on each object, or NULL
* @param item the list item, if found
* @param ... user data to supply to match function (limited to 5 arguments)
* @return SUCCESS if found, NOT_FOUND otherwise