From nobody Tue Feb 10 15:01:21 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=1643019004; cv=none; d=zohomail.com; s=zohoarc; b=JRiGtGDmyAmWnZdjGG2SRIWMRzpaAgJEoUifuLYq7xjEUybdjKC6DfAGaaYK9zrNxeB56MSXnsv9aIA6U3clXpwEfv1JuW2xeEjcFOVlUYHWez+ApiBcJxWDbb1i5Ci0gE9bpo5dOUFT5R3IzCXC+uVVMyL9vqx/d/0q4vzbRjE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1643019004; 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=dGYLxtAmf289Oq5DkclbJZ85zC6+gg9VC3DFWZ3tOlU=; b=IgQmEgpgipEcmJPTu+GxzLky79hSbZ8/f7AMJsTdpgCkBH8yscVT0pbZhxzYY8/I/arjLpoCEXQeCDf5/YdQ0Rp0r9MYyyZBnxSRx9iHpUdTKdkIN4thtNF+SkUH3C8a6jks1NA0Afm4x7ItJRleeGLjUEiosi6llt1H/xLpU8M= 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 1643019004011818.8775923620718; Mon, 24 Jan 2022 02:10:04 -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-451-2UYUSqrDOWeppcEZEZ-lSQ-1; Mon, 24 Jan 2022 05:09:59 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 941381083F69; Mon, 24 Jan 2022 10:09:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 764987B9F4; Mon, 24 Jan 2022 10:09:53 +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 46B581806D1D; Mon, 24 Jan 2022 10:09:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 20OA7up6021089 for ; Mon, 24 Jan 2022 05:07:56 -0500 Received: by smtp.corp.redhat.com (Postfix) id CDB366F120; Mon, 24 Jan 2022 10:07:56 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.195.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 41EFC6D03D for ; Mon, 24 Jan 2022 10:07:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1643019003; 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=dGYLxtAmf289Oq5DkclbJZ85zC6+gg9VC3DFWZ3tOlU=; b=ZUPhL3PzV1mGef5bOYQ788wgArE29HPFecDzg3tha+MD4rVUD4y7QfAO9zBAyOGIHWu/5q b/EC+mWedo/A8nrw/7yggbcsaHTPjMr1nHmn4fkxyhAiTyXivJQGA8JRI085nOk4EbEWxV +YbkfH0LJeLXwuepS8/Z7bxjtCZYl0U= X-MC-Unique: 2UYUSqrDOWeppcEZEZ-lSQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 04/11] virDomainChrSourceDefCopy: return void Date: Mon, 24 Jan 2022 11:07:26 +0100 Message-Id: <4efee5a80b0f59514ceaa7917c77dd98986e070f.1643018556.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com 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.12 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: 1643019009729100003 Content-Type: text/plain; charset="utf-8" This function never returns an error, make it void then. And while at it, make the @src argument const to make it obvious it's never changed inside the function. Signed-off-by: Michal Privoznik --- src/conf/domain_conf.c | 9 +++------ src/conf/domain_conf.h | 4 ++-- src/qemu/qemu_process.c | 5 ++--- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e4abe1854f..bb887d4a3b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2732,11 +2732,10 @@ virDomainChrSourceDefClear(virDomainChrSourceDef *d= ef) } =20 /* Almost deep copies the contents of src into dest. Some parts are not co= pied - * though. - * Returns -1 and report error on failure. */ -int + * though. */ +void virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, - virDomainChrSourceDef *src) + const virDomainChrSourceDef *src) { virDomainChrSourceDefClear(dest); =20 @@ -2799,8 +2798,6 @@ virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, case VIR_DOMAIN_CHR_TYPE_LAST: break; } - - return 0; } =20 static void diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 9bf54eee48..764e025448 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3347,8 +3347,8 @@ void virDomainSmartcardDefFree(virDomainSmartcardDef = *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainSmartcardDef, virDomainSmartcardDef= Free); void virDomainChrDefFree(virDomainChrDef *def); G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainChrDef, virDomainChrDefFree); -int virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, - virDomainChrSourceDef *src) +void virDomainChrSourceDefCopy(virDomainChrSourceDef *dest, + const virDomainChrSourceDef *src) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); void virDomainSoundCodecDefFree(virDomainSoundCodecDef *def); ssize_t virDomainSoundDefFind(const virDomainDef *def, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 336f0bab2e..c9ceec4e19 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2129,9 +2129,8 @@ qemuProcessFindCharDevicePTYsMonitor(virDomainObj *vm, chr->targetType =3D=3D VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERI= AL) { /* yes, the first console is just an alias for serials[0] */ i =3D 1; - if (virDomainChrSourceDefCopy(chr->source, - ((vm->def->serials[0])->source))= < 0) - return -1; + virDomainChrSourceDefCopy(chr->source, + ((vm->def->serials[0])->source)); } } =20 --=20 2.34.1