From nobody Mon Feb 9 07:38:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1667315065; cv=none; d=zohomail.com; s=zohoarc; b=UrP3SlO0kOvvlczdHv5XzGiOE4/TRwi2fBEJ0FGnZh5Nlc2KoVP52EElHDeyANAnSA2U/WNMS9YhThUUfzIPSzn57zOGQfkVb+6sA1R3HNyC5zRJ/ClUzAtfXbSusUKEQVyPy1N3ZMfmgsOQTZWL+DM4avPaAt/ZBTvoxojzh5k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667315065; 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=UTaH5Nx/ZIbXqG+TN037UKzzvzTTW5UDwfX5WkwvU1w=; b=UdZVK9kADmbm+ijLfakt5oDuPPLa7/iIYURXO0LHeA20C6TcXG3MXM8sCULy/JQIjGyLPNHG5rr8CZKX3GHFoNwe9y8UcZb3gSjJ6iA0GhB6nXKlHjqGzg0ZC0ev1caWDO2vVYy9MXAkPbxQtL7TbY7JlAO6n356u9l28T2qSBM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.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.129.124]) by mx.zohomail.com with SMTPS id 166731506536279.23259269627533; Tue, 1 Nov 2022 08:04:25 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-335-4Km9cjDwO_S7Cu5qgZ9y2Q-1; Tue, 01 Nov 2022 11:03:58 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3899928037D4; Tue, 1 Nov 2022 15:03:01 +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 2231240C83EC; Tue, 1 Nov 2022 15:03:01 +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 1313E19465B3; Tue, 1 Nov 2022 15:03:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 287451946594 for ; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1C2162166BB3; Tue, 1 Nov 2022 15:03:00 +0000 (UTC) Received: from speedmetal.redhat.com (ovpn-208-3.brq.redhat.com [10.40.208.3]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8089B2166B2D for ; Tue, 1 Nov 2022 15:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667315063; 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=UTaH5Nx/ZIbXqG+TN037UKzzvzTTW5UDwfX5WkwvU1w=; b=EegJvK3MOjikP9ZYqkRW8DXwtxuhCdd1l3OB699RQEtCgHbWcPFopQ2xPI55RL9LMOKuKU kdlv11WVcbU4MMhQ4L/37+HbDcjnl/pUuH5VKiZSIAYAdF0g2oUxFvi7sklyK5rqatlcMB qojaGSM6j+57zUP2dosN2D/7g8JzqF8= X-MC-Unique: 4Km9cjDwO_S7Cu5qgZ9y2Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/11] conf: domain: Parse 'type' attribute via virXMLPropEnum in virSysinfoParseXML Date: Tue, 1 Nov 2022 16:02:23 +0100 Message-Id: <108adef1c89a3c74f27fc22ce7709be95e1ad4f4.1667314911.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 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.1 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: 1667315066584100001 Content-Type: text/plain; charset="utf-8" Rewrite the code to use the simple helper. Signed-off-by: Peter Krempa --- src/conf/domain_conf.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6379cfda7c..b9494500e2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -12451,8 +12451,6 @@ virSysinfoParseXML(xmlNodePtr node, { VIR_XPATH_NODE_AUTORESTORE(ctxt) virSysinfoDef *def; - g_autofree char *typeStr =3D NULL; - int type; ctxt->node =3D node; @@ -12464,18 +12462,9 @@ virSysinfoParseXML(xmlNodePtr node, def =3D g_new0(virSysinfoDef, 1); - typeStr =3D virXMLPropString(node, "type"); - if (typeStr =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("sysinfo must contain a type attribute")); - goto error; - } - if ((type =3D virSysinfoTypeFromString(typeStr)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown sysinfo type '%s'"), typeStr); + if (virXMLPropEnum(node, "type", virSysinfoTypeFromString, + VIR_XML_PROP_REQUIRED, &def->type) < 0) goto error; - } - def->type =3D type; switch (def->type) { case VIR_SYSINFO_SMBIOS: --=20 2.37.3