From nobody Sun Feb 8 23:32:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.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 216.205.24.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=1616197049; cv=none; d=zohomail.com; s=zohoarc; b=Vtfm8KBvvUKwL4vZCoJ63S1R3seLljILcnRzthc7IWkeeJ3aNfGH2K3mNcXzxB90TT7Lkcd+G25zGV0Em1n8TN1YQSJZvwAvAwRQNs+UgiQMAn45nzOYI49NKchMCwPTVjbX5axo1OyIqPZTRMau4qI0xHBa7JnHq77IUFNogaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616197049; 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=ayPZ7uIJeLxD9+4D2GBPyeFc9WATqdWmKO15VrBGrME=; b=CsGcMXMlposMxvDWynffU40rkTbCAIavQuIc20pYy3LdZQ65mQquNJzwW9hhH1oKYupvNHEYZhHROcuTiKI9uDwpqe2jZRre+8lCMA6T4tL9j2b9PTNlh30lUCqMQJbTRlfFbf9Y1Fk0N2LBHLJYG1kD9RipoNV3ukCr6tl9TOc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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 [216.205.24.124]) by mx.zohomail.com with SMTPS id 1616197049226740.6692058853572; Fri, 19 Mar 2021 16:37:29 -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-499-pkp3XCBwOTqdI8DkQ_0z1g-1; Fri, 19 Mar 2021 19:37:26 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E6A96911EA; Fri, 19 Mar 2021 23:37:19 +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 A3A855DAA5; Fri, 19 Mar 2021 23:37:19 +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 A5C9E1809C84; Fri, 19 Mar 2021 23:37:18 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 12JNbDBj029439 for ; Fri, 19 Mar 2021 19:37:13 -0400 Received: by smtp.corp.redhat.com (Postfix) id D83E318966; Fri, 19 Mar 2021 23:37:13 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.40.194.173]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB7CB5054E for ; Fri, 19 Mar 2021 23:37:13 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 74428244034; Sat, 20 Mar 2021 00:37:07 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616197048; 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=ayPZ7uIJeLxD9+4D2GBPyeFc9WATqdWmKO15VrBGrME=; b=EQROc9EsHvK/J4qeoAMwkrdgaUvPiNS1YriqDwOgvSZwE5VVL0xAC5kKM1kI0UjPjjWRvd XXM4rCa8FV2jf94aDov+IYi26OJy1DScvFwqwuQ5D/mu+7ABob+o6/Sv+idIycCloGaAYi uuth4nnKIUQxDsfKmzINYKFrl5VMPyM= X-MC-Unique: pkp3XCBwOTqdI8DkQ_0z1g-1 From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH 5/7] util: Make virExpandN return void Date: Sat, 20 Mar 2021 00:37:04 +0100 Message-Id: <66f2bdb7c4722e201435ad11af1f5b34d6359cba.1616196713.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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.14 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: Jiri Denemark --- src/util/viralloc.c | 14 ++++++-------- src/util/viralloc.h | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/util/viralloc.c b/src/util/viralloc.c index cd770eb601..81f5ba9a09 100644 --- a/src/util/viralloc.c +++ b/src/util/viralloc.c @@ -66,12 +66,12 @@ int virReallocN(void *ptrptr, * allocated memory. On failure, 'ptrptr' and 'countptr' are not * changed. Any newly allocated memory in 'ptrptr' is zero-filled. * - * Returns zero on success, aborts on OOM + * Aborts on OOM */ -int virExpandN(void *ptrptr, - size_t size, - size_t *countptr, - size_t add) +void virExpandN(void *ptrptr, + size_t size, + size_t *countptr, + size_t add) { if (*countptr + add < *countptr) abort(); @@ -80,7 +80,6 @@ int virExpandN(void *ptrptr, abort(); memset(*(char **)ptrptr + (size * *countptr), 0, size * add); *countptr +=3D add; - return 0; } =20 /** @@ -192,8 +191,7 @@ virInsertElementsN(void *ptrptr, size_t size, size_t at, if (inPlace) { *countptr +=3D add; } else { - if (virExpandN(ptrptr, size, countptr, add) < 0) - abort(); + virExpandN(ptrptr, size, countptr, add); } =20 /* memory was successfully re-allocated. Move up all elements from diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 878c9485cf..6051c91913 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -36,7 +36,7 @@ /* Don't call these directly - use the macros below */ int virReallocN(void *ptrptr, size_t size, size_t count) ATTRIBUTE_NONNULL(1); -int virExpandN(void *ptrptr, size_t size, size_t *count, size_t add) +void virExpandN(void *ptrptr, size_t size, size_t *count, size_t add) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); void virResizeN(void *ptrptr, size_t size, size_t *alloc, size_t count, si= ze_t desired) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); @@ -78,7 +78,7 @@ int virDeleteElementsN(void *ptrptr, size_t size, size_t = at, size_t *countptr, * * This macro is safe to use on arguments with side effects. * - * Returns 0 on success, aborts on OOM + * Aborts on OOM */ #define VIR_EXPAND_N(ptr, count, add) virExpandN(&(ptr), sizeof(*(ptr)), &= (count), add) =20 --=20 2.31.0