From nobody Tue Feb 10 04:14:35 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=1618575729; cv=none; d=zohomail.com; s=zohoarc; b=ZzgIhi7HJLmG2mMKbkUZeIeD2G/p8b9899N9KYaIR/t8bou8ByaTi29Q3BKtFbpmf5REGgk1+zgyyM1IpVlHEt5OINTrMJg7/SfGvt1a0vvZWQdoKEbDf4wE/aitKzHixIk5wiQuaOVcGLVwBe8YVvM0rBlco8LVLrX8fXlRoBw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1618575729; 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=1lgLWViWUVgBvd2k26geGM371lrGdKtkedXf+Ipv1k4=; b=TSFa3R75qSJ6vyYiXmMRGKZwY8WUoxjF++7JNp9ITnXF2dolwFWurztSQaSW4J+K64vVExrqn0WJzqpPb6rZDiC0i2Sso3gFk2zL/H5KI8JMyNgpZ9ouYovmiC0ss7I5aI9E5M4XsMnRJt0vXupFMY71VrCFQpVk/vE7bgj0f6k= 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) header.from= 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 1618575729170134.48746643198103; Fri, 16 Apr 2021 05:22:09 -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-510-uhDjDGQZPsa5Xf3_dRFEPQ-1; Fri, 16 Apr 2021 08:22:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7285910054F6; Fri, 16 Apr 2021 12:22:01 +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 48CFD10023AF; Fri, 16 Apr 2021 12:22:01 +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 0DCA544A62; Fri, 16 Apr 2021 12:22:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 13GCLGBa020654 for ; Fri, 16 Apr 2021 08:21:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id BAC8317C08; Fri, 16 Apr 2021 12:21:16 +0000 (UTC) Received: from work.redhat.com (ovpn-113-12.ams2.redhat.com [10.36.113.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0CDA35D9C0; Fri, 16 Apr 2021 12:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618575728; 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=1lgLWViWUVgBvd2k26geGM371lrGdKtkedXf+Ipv1k4=; b=VFgb17W5kTiQipxI2K1EfP2DfXJh3KtBG7P3O5gWuYPCEpVk8lwTJs+ft5ttilmhGfmpca EzWtiSdQkQz+HixQOGCZecktDFTES4IaqPdaTJQz/fu2quKBVknbtj/KoO9snKS5UQFsgd o7Edw2/nA4n4HjCZFGH/x29nX3WOE0Y= X-MC-Unique: uhDjDGQZPsa5Xf3_dRFEPQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 07/10] virDomainDeviceVirtioSerialAddressParseXML: Use virXMLProp* Date: Fri, 16 Apr 2021 14:20:57 +0200 Message-Id: <20210416122100.360154-8-twiederh@redhat.com> In-Reply-To: <20210416122100.360154-1-twiederh@redhat.com> References: <20210416122100.360154-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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.84 on 10.5.11.22 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: Tim Wiederhake --- src/conf/device_conf.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/conf/device_conf.c b/src/conf/device_conf.c index 5a98cd8c0f..587f966398 100644 --- a/src/conf/device_conf.c +++ b/src/conf/device_conf.c @@ -341,32 +341,19 @@ int virDomainDeviceVirtioSerialAddressParseXML(xmlNodePtr node, virDomainDeviceVirtioSerialAddr= ess *addr) { - g_autofree char *controller =3D virXMLPropString(node, "controller"); - g_autofree char *bus =3D virXMLPropString(node, "bus"); - g_autofree char *port =3D virXMLPropString(node, "port"); - memset(addr, 0, sizeof(*addr)); =20 - if (controller && - virStrToLong_uip(controller, NULL, 10, &addr->controller) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'controller' attribute")); + if (virXMLPropUInt(node, "controller", 10, VIR_XML_PROP_OPTIONAL, + &addr->controller) < 0) return -1; - } =20 - if (bus && - virStrToLong_uip(bus, NULL, 10, &addr->bus) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'bus' attribute")); + if (virXMLPropUInt(node, "bus", 10, VIR_XML_PROP_OPTIONAL, + &addr->bus) < 0) return -1; - } =20 - if (port && - virStrToLong_uip(port, NULL, 10, &addr->port) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Cannot parse
'port' attribute")); + if (virXMLPropUInt(node, "port", 10, VIR_XML_PROP_OPTIONAL, + &addr->port) < 0) return -1; - } =20 return 0; } --=20 2.26.2