From nobody Tue Dec 16 03:43:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1751904404; cv=none; d=zohomail.com; s=zohoarc; b=NwOHUPz7XD68Fzx/gHeTopRjOq27Tj2Cl8K7iO4KBLiARD0rRQXY+hKrVn0dWHfjBUloSKBiw7HLwbGT3nUnod3tIjJLJW5wugSR74Q/uZB1x9QTyGHMxvXKffxC/I+vO/+L7/kzE/0whzQPo1A17OvCPmww0pwKtvTUyYGZtEo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751904404; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=9YlgbV+GpCnz0fV/ZDoZaLP3DlMdGZkIlk08DtD9Iec=; b=fGkuzzuR2kZ7fS4fca2P5Doa8v4scxlE0zfp9uopxxdnD+gynCk7+8OzodEMrEcuSz0IAdU8sV/h9KwsqrGc55AvIszg3l3gRO60PGIFRRxsJ2oNXG0PAhFD35zIf+tLyhtn87KgG9FKJHDGQDQL3+rFmU2kY4v2L5dza3eNOVs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1751904404203960.4379661106186; Mon, 7 Jul 2025 09:06:44 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 373B51458; Mon, 7 Jul 2025 12:06:43 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id ED03A1602; Mon, 7 Jul 2025 12:04:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id B14CD1544; Mon, 7 Jul 2025 12:04:55 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 3F3D31516 for ; Mon, 7 Jul 2025 12:04:48 -0400 (EDT) Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-Qx0_ssggO4qhCXWuEJHkzA-1; Mon, 07 Jul 2025 12:04:46 -0400 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0DACB193F058 for ; Mon, 7 Jul 2025 16:04:46 +0000 (UTC) Received: from kshcheti-thinkpadp1gen4i.tpbc.csb (unknown [10.43.2.22]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 16EE71956087; Mon, 7 Jul 2025 16:04:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751904288; h=from:from: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; bh=NjgWMcmXTt+4HBuuKOcbseAYT8RADdyMONGM6fHQqCg=; b=D6IjpQ3AtwDKmhTj0iojpn3lZGAUIFGyoN6UUWnfoIN3PuaOp4cV3yG0axwljh4cxr06JJ llIZZ0+4RGtC4XMVkGl0MBmYhvCTwZrw3ixZeJjrlv+TpjTNyN/8/9llbXvEavgzOpAP5N 2oFxowtjZb5fIuG/SQ4p8y7WSCl/Yz0= X-MC-Unique: Qx0_ssggO4qhCXWuEJHkzA-1 X-Mimecast-MFC-AGG-ID: Qx0_ssggO4qhCXWuEJHkzA_1751904286 To: devel@lists.libvirt.org Subject: [PATCH 4/5] conf: virDomainChrDefParseTargetXML refactor Date: Mon, 7 Jul 2025 18:03:49 +0200 Message-ID: <20250707160426.184333-5-kshcheti@redhat.com> In-Reply-To: <20250707160426.184333-1-kshcheti@redhat.com> References: <20250707160426.184333-1-kshcheti@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: qUCJy2YBNifN_UxzcH7Smcdd89YpzG1C_OEywfvBBQ4_1751904286 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: FUSCS3C5HO6PADJTN32JPCKK6NNACEH3 X-Message-ID-Hash: FUSCS3C5HO6PADJTN32JPCKK6NNACEH3 X-MailFrom: kshcheti@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Kirill Shchetiniuk X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: From: Kirill Shchetiniuk via Devel Reply-To: Kirill Shchetiniuk X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1751904405177116600 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Refactored the default case port option parsing logic to use the appropriate virXMLPropInt function. Signed-off-by: Kirill Shchetiniuk --- src/conf/domain_conf.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bfc62b6270..42e3db5547 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -10469,7 +10469,6 @@ virDomainChrDefParseTargetXML(virDomainChrDef *def, g_autofree char *targetType =3D virXMLPropString(cur, "type"); g_autofree char *targetModel =3D NULL; g_autofree char *addrStr =3D NULL; - g_autofree char *portStr =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 ctxt->node =3D cur; @@ -10540,20 +10539,8 @@ virDomainChrDefParseTargetXML(virDomainChrDef *def, break; =20 default: - portStr =3D virXMLPropString(cur, "port"); - if (portStr =3D=3D NULL) { - /* Set to negative value to indicate we should set it later */ - def->target.port =3D -1; - break; - } - - if (virStrToLong_ui(portStr, NULL, 10, &port) < 0) { - virReportError(VIR_ERR_XML_ERROR, - _("Invalid port number: %1$s"), - portStr); + if (virXMLPropInt(cur, "port", 10, VIR_XML_PROP_NONNEGATIVE, &def-= >target.port, -1) < 0) return -1; - } - def->target.port =3D port; break; } =20 --=20 2.49.0