aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2014-09-09 14:12:26 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-10 12:08:33 +0200
commit9b10ac869d8c87024dc41f3e1a90cf7d7a64f72d (patch)
treef481aed64f403760b7dcc58a4881bac8d0d5f072
parentfc7a5800ad13fa14529b38d2255fa87f11db626b (diff)
vl: use QLIST_FOREACH_SAFE to visit change state handlers
This lets a handler delete itself. Acked-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--vl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/vl.c b/vl.c
index 9c9acf5e65..15aea95c57 100644
--- a/vl.c
+++ b/vl.c
@@ -1721,11 +1721,11 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
void vm_state_notify(int running, RunState state)
{
- VMChangeStateEntry *e;
+ VMChangeStateEntry *e, *next;
trace_vm_state_notify(running, state);
- for (e = vm_change_state_head.lh_first; e; e = e->entries.le_next) {
+ QLIST_FOREACH_SAFE(e, &vm_change_state_head, entries, next) {
e->cb(e->opaque, running, state);
}
}