From nobody Sun Feb 8 13:28:13 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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=1571925484; cv=none; d=zoho.com; s=zohoarc; b=d90WKcj7JyfqQjZuoHc5M6pdpc+saM14JPT0h//5bIM6X4AXcIvJCZsnlKTgAvKR/X8OtiFqqQQPB95j5Sk2dhqrm8GkjZm9TJtjjuPvfdLLMrP4EAqpEuZMd+qw0bDPuvPBPpqeKyV7AdYg5Xgb9uL1QuSBB9ggCVI4DvPoQZc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571925484; 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=v9bg8+qDpldwtAhXHCUEVGT4qndnN61/R5HOW6SJK0U=; b=g243o40xUzqYN/HaHBsAGcVbqmUwHlD3UcbDsRqhlseZqfvyEjqZ/tGws4cyVfmiFh1/Cr8L2bIG+z4JliuTUABO2UDpEVt9BD9rKRfeVrh/4/9ybAyoeqbvGQrQcL6qUsj2TM3tfJpNIEKBf09w5Ar0KSALEnudY+MfRAdAYgY= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 207.211.31.81 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-1.mimecast.com (207.211.31.81 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1571925484169932.6361849333862; Thu, 24 Oct 2019 06:58:04 -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-90-9o_csn4zPLiGyfoCOo96KQ-1; Thu, 24 Oct 2019 09:57:08 -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 B2E451800E06; Thu, 24 Oct 2019 13:57:02 +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 8E7A35DA8D; Thu, 24 Oct 2019 13:57:02 +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 34BDF180BAA1; Thu, 24 Oct 2019 13:57:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9ODukT0026308 for ; Thu, 24 Oct 2019 09:56:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8E81A100164D; Thu, 24 Oct 2019 13:56:46 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 17E3F1001B33 for ; Thu, 24 Oct 2019 13:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1571925483; 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=v9bg8+qDpldwtAhXHCUEVGT4qndnN61/R5HOW6SJK0U=; b=MhYvWwm9YetAfItWizjjKMrVquJDrOxqYOoUNYf44xtkgwX7TZA4gayqbymcKWKV7D0Wqz +igw/nT+XQw3h1TQtgRUvgMYmYG5syDBtJWrO+bma25jWPJRk3kpKqw2AShLaQY8ivJrJh H5RIvl+tUNpW8Rv/VFfQaBtmgScwnRk= From: Peter Krempa To: libvir-list@redhat.com Date: Thu, 24 Oct 2019 15:56:22 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/19] virsh: Reimplement _vshCalloc using g_malloc0_n 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 X-MC-Unique: 9o_csn4zPLiGyfoCOo96KQ-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Drop the dead code by using glib's allocator. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tools/vsh.c | 12 ++---------- tools/vsh.h | 5 +---- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/tools/vsh.c b/tools/vsh.c index 3f8b7f2186..58ee94b52f 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -129,17 +129,9 @@ _vshMalloc(vshControl *ctl, size_t size, const char *f= ilename, int line) } void * -_vshCalloc(vshControl *ctl, size_t nmemb, size_t size, const char *filenam= e, - int line) +vshCalloc(vshControl *ctl G_GNUC_UNUSED, size_t nmemb, size_t size) { - char *x; - - if (!xalloc_oversized(nmemb, size) && - VIR_ALLOC_N(x, nmemb * size) =3D=3D 0) - return x; - vshError(ctl, _("%s: %d: failed to allocate %d bytes"), - filename, line, (int) (size*nmemb)); - exit(EXIT_FAILURE); + return g_malloc0_n(nmemb, size); } int diff --git a/tools/vsh.h b/tools/vsh.h index ad783e24b7..b6ac070f10 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -468,10 +468,7 @@ char * vshReadline(vshControl *ctl, const char *prompt= ); void *_vshMalloc(vshControl *ctl, size_t sz, const char *filename, int lin= e); #define vshMalloc(_ctl, _sz) _vshMalloc(_ctl, _sz, __FILE__, __LINE__) -void *_vshCalloc(vshControl *ctl, size_t nmemb, size_t sz, - const char *filename, int line); -#define vshCalloc(_ctl, _nmemb, _sz) \ - _vshCalloc(_ctl, _nmemb, _sz, __FILE__, __LINE__) +void *vshCalloc(vshControl *ctl, size_t nmemb, size_t sz); /* Macros to help dealing with mutually exclusive options. */ --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list