aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Brunner <tobias@strongswan.org>2012-02-29 18:06:49 +0100
committerTobias Brunner <tobias@strongswan.org>2012-03-20 17:31:40 +0100
commit68611395dc11fecdf736893c06bb26b68e05fc06 (patch)
tree1eef92d26da1c0234c354c4d07a0876520379bac
parent1726795fa9abe4b32ecbd7abd721ecced6c9af9c (diff)
downloadstrongswan-68611395dc11fecdf736893c06bb26b68e05fc06.tar.bz2
strongswan-68611395dc11fecdf736893c06bb26b68e05fc06.tar.xz
chunk_equals_ptr added to compare chunks given as pointers.
-rw-r--r--src/libstrongswan/chunk.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libstrongswan/chunk.h b/src/libstrongswan/chunk.h
index 672664874..ff569ac13 100644
--- a/src/libstrongswan/chunk.h
+++ b/src/libstrongswan/chunk.h
@@ -251,6 +251,15 @@ static inline bool chunk_equals(chunk_t a, chunk_t b)
}
/**
+ * Compare two chunks (given as pointers) for equality (useful as callback),
+ * NULL chunks are never equal.
+ */
+static inline bool chunk_equals_ptr(chunk_t *a, chunk_t *b)
+{
+ return a != NULL && b != NULL && chunk_equals(*a, *b);
+}
+
+/**
* Increment a chunk, as it would reprensent a network order integer.
*
* @param chunk chunk to increment