watchlist: added macro for notifying with no args

The macros currently did not support notifying a watchlist with
no extra arguments.
This commit is contained in:
James Prestwood 2017-11-14 09:25:32 -08:00 committed by Denis Kenzior
parent c0fe2b78c4
commit 1d119d58c1
1 changed files with 17 additions and 1 deletions

View File

@ -2,7 +2,7 @@
*
* Wireless daemon for Linux
*
* Copyright (C) 2016 Intel Corporation. All rights reserved.
* Copyright (C) 2016-2017 Intel Corporation. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -92,3 +92,19 @@ void __watchlist_prune_stale(struct watchlist *watchlist);
if ((watchlist)->stale_items) \
__watchlist_prune_stale(watchlist); \
} while (false)
#define WATCHLIST_NOTIFY_NO_ARGS(watchlist, type) \
do { \
const struct l_queue_entry *entry = \
l_queue_get_entries((watchlist)->items);\
\
(watchlist)->in_notify = true; \
for (; entry; entry = entry->next) { \
struct watchlist_item *item = entry->data; \
type t = item->notify; \
t(item->notify_data); \
} \
(watchlist)->in_notify = false; \
if ((watchlist)->stale_items) \
__watchlist_prune_stale(watchlist); \
} while (false)