From a6014fc51b2c1723ac65afe1026feff9a8670676 Mon Sep 17 00:00:00 2001 From: John Dennis Date: Mon, 25 May 2015 11:19:53 -0400 Subject: [PATCH] Add lasso_is_in_list_of_strings macro to utils.h Add macro that tests to see if a string is a member in a list of strings. Signed-off-by: John Dennis License: MIT --- lasso/utils.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lasso/utils.h b/lasso/utils.h index 6507de7e..30957a91 100644 --- a/lasso/utils.h +++ b/lasso/utils.h @@ -442,6 +442,11 @@ *__tmp_list = g_list_remove(*__tmp_list, __tmp); \ lasso_unref(__tmp); } while(0) +/* List element membership */ +#define lasso_is_in_list_of_strings(list, item) \ + g_list_find_custom(list, item, (GCompareFunc)g_strcmp0) == NULL ? FALSE : TRUE + + /* Pointer ownership transfer */ /* lasso_transfer_xxx macros are like lasso_assign_xxx but they do not increment reference count or