From nobody Tue Dec 16 03:04:41 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=1751904421; cv=none; d=zohomail.com; s=zohoarc; b=ZNDJZ88+RevKeL1153VUCKZ0LCwqGGfa9iujf3oZBLOd+2woy/i6xq5FfhC4QScMSnwSF0JVqBufNpm8j3dRrVzd2/qULqjTmMs6lKJN+g81MptkNBhZ6d24Qs+x3R1WMr2uslD7gY89UpjUPHqJ791oGJIIfiWA7yvFYnXuM14= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751904421; 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=ylLInG6sbkjpoTcMbSFOZbm0gl2TJDPPSaVzi7eq0/M=; b=Kgu7Dg+4sOSzZBCVwQwyU/aShYF5qXSNyfMGkKAGpwgHg/KhufC07iIqBG1/AyLa/cC7fxpIWy8b+YMHgRlkHkzc4BUIDgrMpC+RPrRh0HQukKKHtJ0osxU5cCOrTXwQMq5zNVf+Y9g3NYIM1IF6LR4kUPzt2p45C8mBvts0tnE= 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 1751904421129871.6031179964662; Mon, 7 Jul 2025 09:07:01 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 19574BD5; Mon, 7 Jul 2025 12:06:59 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id E82D41589; Mon, 7 Jul 2025 12:05:07 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 913D014A2; Mon, 7 Jul 2025 12:05:02 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 46224138E for ; Mon, 7 Jul 2025 12:04:50 -0400 (EDT) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-471-NcI-ZTJXPoGpriZTZEL20Q-1; Mon, 07 Jul 2025 12:04:48 -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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 7BEEC180028C for ; Mon, 7 Jul 2025 16:04:47 +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 7C445195609D; Mon, 7 Jul 2025 16:04:46 +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=1751904289; 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=bCfdKlPDgFKKQpIqxMrh2zjL4m28Kpo5rjekWiv9nnA=; b=KsxeZlTo6c6u/K79JLoN/6iloSsQrkPxknsjEdLORgUUtKc+9+gMrbE1FTzuINREKYw5JP /DxNHrSbOEii9V3uxqhXqKhSCgQZrtdAKwJE0JEJyNTUp0G0fAVIRiPyr9HOr7itf+nBfy mLxoytXj8Dpju8bAh8rWXu6YwANuF3E= X-MC-Unique: NcI-ZTJXPoGpriZTZEL20Q-1 X-Mimecast-MFC-AGG-ID: NcI-ZTJXPoGpriZTZEL20Q_1751904287 To: devel@lists.libvirt.org Subject: [PATCH 5/5] qemu: qemuDomainObjPrivateXMLParseVcpu refactor Date: Mon, 7 Jul 2025 18:03:50 +0200 Message-ID: <20250707160426.184333-6-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: R9zBrJ3c13swrPXW0Cb_snaXOzWVK0mnBqK46iTF8Fs_1751904287 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: UMSN4E4XZSRH3UUHG27M3AIIR3TCC2KE X-Message-ID-Hash: UMSN4E4XZSRH3UUHG27M3AIIR3TCC2KE 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: 1751904423286116600 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Kirill Shchetiniuk Refactored the qemuDomainObjPrivateXMLParseVcpu function to use the appropriate virXMLPropUInt function to parse unsigned integers, avoiding unccessery string parsing operations. Signed-off-by: Kirill Shchetiniuk --- src/qemu/qemu_domain.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2d62bcc62b..2b505fbddb 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2811,28 +2811,18 @@ qemuDomainObjPrivateXMLParseVcpu(xmlNodePtr node, virDomainDef *def) { virDomainVcpuDef *vcpu; - g_autofree char *idstr =3D NULL; - g_autofree char *pidstr =3D NULL; unsigned int tmp; =20 - idstr =3D virXMLPropString(node, "id"); - - if (idstr && - (virStrToLong_uip(idstr, NULL, 10, &idx) < 0)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse vcpu index '%1$s'"), idstr); + if (virXMLPropUInt(node, "id", 10, VIR_XML_PROP_REQUIRED, &idx) < 0) return -1; - } + if (!(vcpu =3D virDomainDefGetVcpu(def, idx))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("invalid vcpu index '%1$u'"), idx); return -1; } =20 - if (!(pidstr =3D virXMLPropString(node, "pid"))) - return -1; - - if (virStrToLong_uip(pidstr, NULL, 10, &tmp) < 0) + if (virXMLPropUInt(node, "pid", 10, VIR_XML_PROP_REQUIRED, &tmp) < 0) return -1; =20 QEMU_DOMAIN_VCPU_PRIVATE(vcpu)->tid =3D tmp; --=20 2.49.0