From nobody Sun Feb 8 10:49:21 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.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 63.128.21.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=1601475409; cv=none; d=zohomail.com; s=zohoarc; b=PaWWBnxifW+bbUgfHu6eaM1kUBBabmpIjNSy5Bm/slzWNqMuM0DdkB55qzUc81/m14qI6+32PwH/FYXsLQrjW1laITvCUKq3BokZyh8fI1YkueZVDKqvucogbaHc9/XKMppQFIQCUkT+yaarS4GRgUpcUFjYVkVCvuL4WnzkBJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1601475409; 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=FEAlvH97tF4stYKCEJS51jUvaspakhz9ILHXXOSp2o4=; b=eMv0DefKPMJMweUbMKeGkrgDWUOfjnzyjBp8Z+h5qtwlAC10noW+XwEfWpM+YN0AIJSXHEa6tC/a8atV6cf3MalrKD9vXyU1djsEKjkEvivwCU59xAl8UwpC2VEdFPJPG8fkHidaULao6w4Mxo2zZZOgrinmTjQWtejGc6ezAIc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.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 [63.128.21.124]) by mx.zohomail.com with SMTPS id 1601475409749657.015331262096; Wed, 30 Sep 2020 07:16:49 -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-170-17xxLV3TPQ-ykkAAyBNY0w-1; Wed, 30 Sep 2020 10:16:46 -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 0BFF8186DD31; Wed, 30 Sep 2020 14:16:38 +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 699C05D9F3; Wed, 30 Sep 2020 14:16:37 +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 6D8C3183D021; Wed, 30 Sep 2020 14:16:36 +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 08UEB2ZS017610 for ; Wed, 30 Sep 2020 10:11:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0EFCF6198B; Wed, 30 Sep 2020 14:11:02 +0000 (UTC) Received: from hjs.redhat.com (unknown [10.43.2.12]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8BE4E60C07 for ; Wed, 30 Sep 2020 14:11:01 +0000 (UTC) Dkim-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1601475408; 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=FEAlvH97tF4stYKCEJS51jUvaspakhz9ILHXXOSp2o4=; b=JZ9NXuuwwZMnL+Mi+tXH+YSFG3p8368WGlLT8AerhIKtXn2yCPQppE/VkFWak/lChHxI4F rqya+WXOHVHNe71ZyraMaJZsLhWtnsjqT1gkN1bqiZsXPqEtYGr5qXnpedCPnrKIdnQv2Z vLGQ2FVCgJLH070iidsRyp2aZYUEdhU= X-MC-Unique: 17xxLV3TPQ-ykkAAyBNY0w-1 From: =?UTF-8?q?J=C3=A1n=20Tomko?= To: libvir-list@redhat.com Subject: [libvirt PATCH 1/3] logging: use g_new0 instead of VIR_ALLOC Date: Wed, 30 Sep 2020 16:10:53 +0200 Message-Id: <8d6b2a51ecfa0ec87f4fdc5ad8af67d81d697116.1601475025.git.jtomko@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-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Signed-off-by: J=C3=A1n Tomko --- src/logging/log_daemon.c | 9 +++------ src/logging/log_daemon_config.c | 3 +-- src/logging/log_handler.c | 9 +++------ src/logging/log_manager.c | 3 +-- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c index 0649a70c9d..be93c63eb5 100644 --- a/src/logging/log_daemon.c +++ b/src/logging/log_daemon.c @@ -116,8 +116,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool priv= ileged) virLogDaemonPtr logd; virNetServerPtr srv =3D NULL; =20 - if (VIR_ALLOC(logd) < 0) - return NULL; + logd =3D g_new0(virLogDaemon, 1); =20 g_mutex_init(&logd->lock); =20 @@ -214,8 +213,7 @@ virLogDaemonNewPostExecRestart(virJSONValuePtr object, = bool privileged, virJSONValuePtr child; const char *serverNames[] =3D { "virtlogd" }; =20 - if (VIR_ALLOC(logd) < 0) - return NULL; + logd =3D g_new0(virLogDaemon, 1); =20 g_mutex_init(&logd->lock); =20 @@ -330,8 +328,7 @@ virLogDaemonClientNew(virNetServerClientPtr client, unsigned long long timestamp; bool privileged =3D opaque !=3D NULL; =20 - if (VIR_ALLOC(priv) < 0) - return NULL; + priv =3D g_new0(virLogDaemonClient, 1); =20 g_mutex_init(&priv->lock); =20 diff --git a/src/logging/log_daemon_config.c b/src/logging/log_daemon_confi= g.c index 97f2de90a6..5577991b13 100644 --- a/src/logging/log_daemon_config.c +++ b/src/logging/log_daemon_config.c @@ -58,8 +58,7 @@ virLogDaemonConfigNew(bool privileged G_GNUC_UNUSED) { virLogDaemonConfigPtr data; =20 - if (VIR_ALLOC(data) < 0) - return NULL; + data =3D g_new0(virLogDaemonConfig, 1); =20 data->max_clients =3D 1024; data->admin_max_clients =3D 5000; diff --git a/src/logging/log_handler.c b/src/logging/log_handler.c index 87748d96d1..d47009d686 100644 --- a/src/logging/log_handler.c +++ b/src/logging/log_handler.c @@ -221,8 +221,7 @@ virLogHandlerLogFilePostExecRestart(virLogHandlerPtr ha= ndler, const char *domuuid; const char *tmp; =20 - if (VIR_ALLOC(file) < 0) - return NULL; + file =3D g_new0(virLogHandlerLogFile, 1); =20 handler->inhibitor(true, handler->opaque); =20 @@ -389,8 +388,7 @@ virLogHandlerDomainOpenLogFile(virLogHandlerPtr handler, if (virPipe(pipefd) < 0) goto error; =20 - if (VIR_ALLOC(file) < 0) - goto error; + file =3D g_new0(virLogHandlerLogFile, 1); =20 file->watch =3D -1; file->pipefd =3D pipefd[0]; @@ -537,8 +535,7 @@ virLogHandlerDomainReadLogFile(virLogHandlerPtr handler, if (virRotatingFileReaderSeek(file, inode, offset) < 0) goto error; =20 - if (VIR_ALLOC_N(data, maxlen + 1) < 0) - goto error; + data =3D g_new0(char, maxlen + 1); =20 got =3D virRotatingFileReaderConsume(file, data, maxlen); if (got < 0) diff --git a/src/logging/log_manager.c b/src/logging/log_manager.c index fd7c2922b3..57be340a2d 100644 --- a/src/logging/log_manager.c +++ b/src/logging/log_manager.c @@ -113,8 +113,7 @@ virLogManagerNew(bool privileged) { virLogManagerPtr mgr; =20 - if (VIR_ALLOC(mgr) < 0) - goto error; + mgr =3D g_new0(virLogManager, 1); =20 if (!(mgr->client =3D virLogManagerConnect(privileged, &mgr->program))) goto error; --=20 2.26.2