From: Paolo Bonzini Date: Tue, 9 Sep 2014 12:12:26 +0000 (+0200) Subject: vl: use QLIST_FOREACH_SAFE to visit change state handlers X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~597^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9b10ac869d8c87024dc41f3e1a90cf7d7a64f72d;p=sdk%2Femulator%2Fqemu.git vl: use QLIST_FOREACH_SAFE to visit change state handlers This lets a handler delete itself. Acked-by: Juan Quintela Signed-off-by: Paolo Bonzini --- diff --git a/vl.c b/vl.c index 9c9acf5..15aea95 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); } }