From nobody Sun Feb 8 23:26:50 2026 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=1664872652; cv=none; d=zohomail.com; s=zohoarc; b=YBrryfg7ms19POY8bHt1L9phzqVV42Yl/7d53OwZ7Gcvza/0GLg6gpitQUy+n54fb/xf0gZRDdQqvhhDjr720BFwS3XIGCxTMjlWywECN2C0b+6H9d4T6m7Iz2Uzu9VnTehXS7SuSPC5JKamhE+Ow9kuV3/sQmd5/A37DXFp208= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664872652; 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=tF7Dj2wcBmD8Kq36tx9yQN7BbUjh6MiYgIis3Je1F4E=; b=OLZiklOhC/u0cZXZEI3xLlc3Pun55wTBKtMNMPk19IbfmgWBKV6C+QFPwC6oOAavPOufxOLHctNBnH0hwfThA1ndXCLzV3HH01WhCre4aTl3gDag6///ruST02Ne5oERDX6DUCFPVKij71Y1pbxRHGRea8jEL1Gl9FUVwUyGk2U= 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 166487265200880.93009760583925; Tue, 4 Oct 2022 01:37:32 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-215-NITKWIPyPrGm09WgE94Rzg-1; Tue, 04 Oct 2022 04:34:01 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DC69A80280D; Tue, 4 Oct 2022 08:33:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8F714A9254; Tue, 4 Oct 2022 08:33:57 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AEF961947042; Tue, 4 Oct 2022 08:33:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 28096194705C for ; Tue, 4 Oct 2022 08:33:53 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0D0CB40C6EC2; Tue, 4 Oct 2022 08:33:53 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F7BF40C6EC3 for ; Tue, 4 Oct 2022 08:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664872651; 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=tF7Dj2wcBmD8Kq36tx9yQN7BbUjh6MiYgIis3Je1F4E=; b=cBXlyOTpnniqaugq0uAMD4VMAyZZ3A7HkwsMyE51zL3zOtNAYIjlr/tQcvcRSNaH1aqguR qN/iKZihQEO+8v/S5smCYoU6Nn9hIezZ4xs+NWdqUEXil8B1bgIdRUtiAXjx6QRmWun2oq ilC4LkUt0We25vDzQUGDlofLTV1Axps= X-MC-Unique: NITKWIPyPrGm09WgE94Rzg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 37/43] qemu: capabilities: Convert virQEMUCapsLoadCache to virXMLParse Date: Tue, 4 Oct 2022 10:33:11 +0200 Message-Id: <1536bc6e94dfe684dc7f27e1d1f9b17b79f2b414.1664870258.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 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: 1664872652465100001 Content-Type: text/plain; charset="utf-8" Use virXMLParse so that the code doesn't have to explicitly allocate an XPath context and validate the root element. Signed-off-by: Peter Krempa --- src/qemu/qemu_capabilities.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e84310c79a..146c3daa39 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4359,22 +4359,9 @@ virQEMUCapsLoadCache(virArch hostArch, long long int l; unsigned long lu; - if (!(doc =3D virXMLParseFile(filename))) + if (!(doc =3D virXMLParse(filename, NULL, NULL, "qemuCaps", &ctxt, NUL= L, false))) return -1; - if (!(ctxt =3D virXMLXPathContextNew(doc))) - return -1; - - ctxt->node =3D xmlDocGetRootElement(doc); - - if (STRNEQ((const char *)ctxt->node->name, "qemuCaps")) { - virReportError(VIR_ERR_XML_ERROR, - _("unexpected root element <%s>, " - "expecting "), - ctxt->node->name); - return -1; - } - if (virXPathLongLong("string(./selfctime)", ctxt, &l) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing selfctime in QEMU capabilities XML")); --=20 2.37.3