qapi: add test cases for generated free functions
[qemu/mdroth.git] / notify.c
bloba6bac1f7837f93adad787f1c06f586c2e35d31d2
1 /*
2 * Notifier lists
4 * Copyright IBM, Corp. 2010
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
14 #include "qemu-common.h"
15 #include "notify.h"
17 void notifier_list_init(NotifierList *list)
19 QTAILQ_INIT(&list->notifiers);
22 void notifier_list_add(NotifierList *list, Notifier *notifier)
24 QTAILQ_INSERT_HEAD(&list->notifiers, notifier, node);
27 void notifier_list_remove(NotifierList *list, Notifier *notifier)
29 QTAILQ_REMOVE(&list->notifiers, notifier, node);
32 void notifier_list_notify(NotifierList *list, void *data)
34 Notifier *notifier, *next;
36 QTAILQ_FOREACH_SAFE(notifier, &list->notifiers, node, next) {
37 notifier->notify(notifier, data);