From nobody Sun Feb 8 17:42:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1618496957; cv=none; d=zohomail.com; s=zohoarc; b=adPFRE0MrIh7nKXC8u8iwRjAMwpRgMVsb3f5TcMDdPHZ4SHbevSj0IFHeHpNT/c7dkzAQ7phMYfDq4nesXz8WGlgoN/WFM7LJAmZ3YAexukYhBtJ9nt/xn9Xhh4ejXQDE1UqF42pqNRxd3WsOkt5/a0rmWhkQuIGZkG9boSH/Vc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618496957; h=Content-Type:Content-Transfer-Encoding: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=46On4N2M4/JKkCeQSTl8Lzol+4uc+ZbfJEaa3dpbpU4=; b=D0Sd8WJVzq6A/fnGWtm74tNbE/UVzqj9eSutQ/lHyzauuP85u0tFx87rMxG4IgtYjCQ06z4yfN2UjJXOpN2vZV98Lofv1Edn5MQweKkS0uMaPKWjjht02lvSJVhBHiNUTn91Gyb/3noZnHRvPdQuAJA/hzPx4D/HsBVEroLWbyg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1618496957433404.06995063932334; Thu, 15 Apr 2021 07:29:17 -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-449-dFG2vuaxOrOn00p-Dk4L3A-1; Thu, 15 Apr 2021 10:29:12 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D19B0101C7D8; Thu, 15 Apr 2021 14:27:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B26DA60917; Thu, 15 Apr 2021 14:27:59 +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 7D00D1806D1B; Thu, 15 Apr 2021 14:27:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13FERw8r024503 for ; Thu, 15 Apr 2021 10:27:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id E2A40694CD; Thu, 15 Apr 2021 14:27:58 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.196.1]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7E9A453CC3 for ; Thu, 15 Apr 2021 14:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618496956; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=46On4N2M4/JKkCeQSTl8Lzol+4uc+ZbfJEaa3dpbpU4=; b=NsQgx4vducVkYiofz6/rUwxTRfEyawSdllcIHbPSOIqix4nHyAAyP6lC/P/7s3oDpyPYOp 2bASdw8FwW+IBwkOBwjIymQSnjt40/gPTsdGIukrg1q0mx2jdb3M/aDU6/2wQDJnTF4geQ Ywl1jfRCHdokG/fErj5FhAcOob0NuD0= X-MC-Unique: dFG2vuaxOrOn00p-Dk4L3A-1 From: Kristina Hanicova To: libvir-list@redhat.com Subject: [PATCH 20/21] Refactoring virDomainVideoDriverDefParseXML() to use XPath Date: Thu, 15 Apr 2021 16:26:35 +0200 Message-Id: <44e68939f99047f7fe13bb97f3dddf4b65e05779.1618495577.git.khanicov@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@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.13 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) Content-Type: text/plain; charset="utf-8" Signed-off-by: Kristina Hanicova --- src/conf/domain_conf.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b9816c46ed..a5dce8a8af 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -15049,25 +15049,16 @@ virDomainVideoResolutionDefParseXML(xmlNodePtr no= de) =20 static virDomainVideoDriverDef * virDomainVideoDriverDefParseXML(xmlNodePtr node, - xmlXPathContextPtr ctxt G_GNUC_UNUSED) + xmlXPathContextPtr ctxt) { - xmlNodePtr cur; virDomainVideoDriverDef *def; int val; g_autofree char *vgaconf =3D NULL; + VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 - cur =3D node->children; - while (cur !=3D NULL) { - if (cur->type =3D=3D XML_ELEMENT_NODE) { - if (!vgaconf && - virXMLNodeNameEqual(cur, "driver")) { - vgaconf =3D virXMLPropString(cur, "vgaconf"); - } - } - cur =3D cur->next; - } + ctxt->node =3D node; =20 - if (!vgaconf) + if (!(vgaconf =3D virXPathString("string(./driver/@vgaconf)", ctxt))) return NULL; =20 def =3D g_new0(virDomainVideoDriverDef, 1); --=20 2.30.2