From nobody Mon Feb 9 23:43:04 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=1641993122; cv=none; d=zohomail.com; s=zohoarc; b=XLA0F0uUJqPqWC8otYW3tKcDHvVP5DshJkCDevPZnq1ZjGNnUBwjBWNT4vdDGHjNT7nvSH5X3B1J3upXlnay43pqU0DkIzh7eago+lTQ0CYjZAnKwldjgAJrb7SUrEBodHUyH9tW2qeldySJ6H/0HqRxLlbbKHcq8ew+4AHb45U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1641993122; 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=eVA9wnm2s7VSJ2bLJ0IpCeO5PUcYQOXXCFEZ51n77Fk=; b=Fp9lvCRrR75QxZftY13JEToOIuuN/u6OBCzaCjRqng3m83qPiribUf0JOB79eE2bDbFWZrSym5rcy6R32Yxbg8QGG+EYASoO3LF9N5PpvLfJFcwuTWHg3d1jtuuZSge714HCPWboZhTuK9pxs5uVJc8u/gb0BpGO9b+HQQlpfs4= 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 1641993122596774.157213648034; Wed, 12 Jan 2022 05:12:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-622-bRLM2W0MPHuZkh1InArl-Q-1; Wed, 12 Jan 2022 08:11:44 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CC4181F2DC; Wed, 12 Jan 2022 13:11:38 +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 A8A2E7BB5E; Wed, 12 Jan 2022 13:11:38 +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 722804A7CB; Wed, 12 Jan 2022 13:11:38 +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 20CDBZ6n004693 for ; Wed, 12 Jan 2022 08:11:35 -0500 Received: by smtp.corp.redhat.com (Postfix) id DC5D42634C; Wed, 12 Jan 2022 13:11:35 +0000 (UTC) Received: from work.speedport.ip (unknown [10.39.193.168]) by smtp.corp.redhat.com (Postfix) with ESMTP id 25A0526364; Wed, 12 Jan 2022 13:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641993121; 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=eVA9wnm2s7VSJ2bLJ0IpCeO5PUcYQOXXCFEZ51n77Fk=; b=iL7aWNpluA96wsNGpR1TfCi/QHrfwgfIb3RMEZfssAIFFiHJrk/yVyuWnDVtUZ5Ty8YgQg Yrg+IoInjoBN3C6xsJdxTW8zngbbF/i0L8HM5CHIzPmcSwYszC8nadAcw+5+S8xrnB3k3Y fV7NpjOmu/42/9WEEQIJkVzGwwz99S8= X-MC-Unique: bRLM2W0MPHuZkh1InArl-Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 13/14] virInterfaceDefParseXML: Simplify and cleanup Date: Wed, 12 Jan 2022 14:10:14 +0100 Message-Id: <20220112131015.100288-14-twiederh@redhat.com> In-Reply-To: <20220112131015.100288-1-twiederh@redhat.com> References: <20220112131015.100288-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.16 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: 1641993124526100003 Content-Type: text/plain; charset="utf-8" Signed-off-by: Tim Wiederhake --- src/conf/interface_conf.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c index 8f8e8871cb..7c2a0f162c 100644 --- a/src/conf/interface_conf.c +++ b/src/conf/interface_conf.c @@ -573,26 +573,14 @@ static virInterfaceDef * virInterfaceDefParseXML(xmlXPathContextPtr ctxt, int parentIfType) { - g_autoptr(virInterfaceDef) def =3D NULL; - int type; - g_autofree char *tmp =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) + g_autoptr(virInterfaceDef) def =3D NULL; + virInterfaceType type; xmlNodePtr lnk; =20 - - /* check @type */ - tmp =3D virXPathString("string(./@type)", ctxt); - if (tmp =3D=3D NULL) { - virReportError(VIR_ERR_XML_ERROR, - "%s", _("interface misses the type attribute")); + if (virXMLPropEnum(ctxt->node, "type", virInterfaceTypeFromString, + VIR_XML_PROP_REQUIRED, &type) < 0) return NULL; - } - type =3D virInterfaceTypeFromString(tmp); - if (type =3D=3D -1) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown interface type %s"), tmp); - return NULL; - } =20 def =3D g_new0(virInterfaceDef, 1); =20 @@ -680,7 +668,8 @@ virInterfaceDefParseXML(xmlXPathContextPtr ctxt, return NULL; break; } - + case VIR_INTERFACE_TYPE_LAST: + return NULL; } =20 return g_steal_pointer(&def); --=20 2.31.1