From nobody Thu Mar 28 15:32:49 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1633700510; cv=none; d=zohomail.com; s=zohoarc; b=Iplj63kMC43LAkCsPdeV7rSsM7XKVN8ImlWBGsqY4F2w9tshLczWx+ydo9rs7E1ZFAj2iNYAHfkyikw5bMQ08S8P7hGERrnCJP8wJtUfRD3kpl/9QZCEKI++G7c4ahqUpGwb4+QrQremO6Z8hjH7PRMa7k/UIZGbdFKCMt91xRo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1633700510; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=ay4cEGM+TksSSO9dG8Iw7U8rGLazAjBDJGRHxi08bIk=; b=Gr61lxUXjeV10MMiknBomNxpim5I6tQRygiDXUPG1xD+XdzG/i6ztG6vAuuM0yoouCg5DM99fl8W1or8WRh/0SNdRm3NR3SLELBFn5t+n7D76jlpl8dL3FkzYBjMnbzZA+SB66dyrJKzmvbYwXXNXMjWu0JwhJHIDnioPyhwERg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1633700509902583.2391300905404; Fri, 8 Oct 2021 06:41:49 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-300-7-uap5p8NvuGMfHHhHvuuA-1; Fri, 08 Oct 2021 09:37:08 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 360278F993B; Fri, 8 Oct 2021 13:36:16 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1808C5D9DE; Fri, 8 Oct 2021 13:36:16 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D648F4EA30; Fri, 8 Oct 2021 13:36:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 198DaE7G026215 for ; Fri, 8 Oct 2021 09:36:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id B4B1419741; Fri, 8 Oct 2021 13:36:14 +0000 (UTC) Received: from merkur.redhat.com (unknown [10.39.193.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 95EA6196E2; Fri, 8 Oct 2021 13:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633700508; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=ay4cEGM+TksSSO9dG8Iw7U8rGLazAjBDJGRHxi08bIk=; b=ZDTBs5ZVaVx6nnXu33ELTEkLD09uZj+gbwtPpE+X3jvX28yAwuqPp0oF/A0KCLAkGVuW8z QW5mDTSrqn2jr0nIKUQxM6dw1/Xj9BdXLwkwSPGVSQh+LEdFv2yfZQ11CDWENfByyTy2op KQOuEZRF9+objwlGX9Sr0KP7lQPbIzE= X-MC-Unique: 7-uap5p8NvuGMfHHhHvuuA-1 From: Kevin Wolf To: qemu-devel@nongnu.org Subject: [PATCH v2 10/15] qemu-option: Allow deleting opts during qemu_opts_foreach() Date: Fri, 8 Oct 2021 15:34:37 +0200 Message-Id: <20211008133442.141332-11-kwolf@redhat.com> In-Reply-To: <20211008133442.141332-1-kwolf@redhat.com> References: <20211008133442.141332-1-kwolf@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: kwolf@redhat.com, damien.hedde@greensocs.com, pkrempa@redhat.com, ehabkost@redhat.com, qemu-block@nongnu.org, mst@redhat.com, libvir-list@redhat.com, jasowang@redhat.com, quintela@redhat.com, armbru@redhat.com, vsementsov@virtuozzo.com, lvivier@redhat.com, its@irrelevant.dk, pbonzini@redhat.com, eblake@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1633700511475100001 Content-Type: text/plain; charset="utf-8" Use QTAILQ_FOREACH_SAFE() so that the current QemuOpts can be deleted while iterating through the whole list. Signed-off-by: Kevin Wolf Reviewed-by: Vladimir Sementsov-Ogievskiy --- util/qemu-option.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/qemu-option.c b/util/qemu-option.c index 61cb4a97bd..eedd08929b 100644 --- a/util/qemu-option.c +++ b/util/qemu-option.c @@ -1126,11 +1126,11 @@ int qemu_opts_foreach(QemuOptsList *list, qemu_opts= _loopfunc func, void *opaque, Error **errp) { Location loc; - QemuOpts *opts; + QemuOpts *opts, *next; int rc =3D 0; =20 loc_push_none(&loc); - QTAILQ_FOREACH(opts, &list->head, next) { + QTAILQ_FOREACH_SAFE(opts, &list->head, next, next) { loc_restore(&opts->loc); rc =3D func(opaque, opts, errp); if (rc) { --=20 2.31.1