From 68611395dc11fecdf736893c06bb26b68e05fc06 Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 29 Feb 2012 18:06:49 +0100 Subject: chunk_equals_ptr added to compare chunks given as pointers. --- src/libstrongswan/chunk.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/libstrongswan/chunk.h') 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 @@ -250,6 +250,15 @@ static inline bool chunk_equals(chunk_t a, chunk_t b) a.len == b.len && memeq(a.ptr, b.ptr, a.len); } +/** + * 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. * -- cgit v1.2.3