From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1599737475; cv=none; d=zohomail.com; s=zohoarc; b=h6DRcbvG1Qkk0wu7wdd7l3TAJ8RSuFVgzOBo0XQiU0gdXuGASqL/PExHLN9WlV/Iitp30DqiT+na1QvF4oAkRIyaOwnIpOFJMHK0j1XuZxDSZSxTYAj1xAE0YryUe69I/6bfrnRx/Sk5EDbZREscL6Bf6MbIyezLNg27QD0cEC0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737475; h=Content-Type:Content-Transfer-Encoding:Cc: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=Ls7Rzv4040Q+g+rkDAxORPFkurKfsR9k6gISekeNr38=; b=XgZdZh8NgRnWktaKZX+J9DKC/d6NY4XHxx6gKrivsT3RDzv2mnthh3CELULZYS2ZCegaWtWEMlKvb2+DEZVW1PwITbwfervXAImw4yla2lhR3ijL+xnFpB2Dnf9TOuPEmZCkTayZDkOGqL+N4IQ4/fRINdTvj9q+RpOmTb14MDQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 159973747520337.87875564705121; Thu, 10 Sep 2020 04:31:15 -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-67-19ZB4_sGOZ6LtnAp6MBfxA-1; Thu, 10 Sep 2020 07:31:11 -0400 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 902D1800466; Thu, 10 Sep 2020 11:31:05 +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 7680B60C87; Thu, 10 Sep 2020 11:31:04 +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 615B8181A270; Thu, 10 Sep 2020 11:31:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTVbh028219 for ; Thu, 10 Sep 2020 07:29:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6914B5C230; Thu, 10 Sep 2020 11:29:31 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id AB7145C1CF; Thu, 10 Sep 2020 11:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737473; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Ls7Rzv4040Q+g+rkDAxORPFkurKfsR9k6gISekeNr38=; b=ahHDmAs7aUWP2oUzckYnhN6SsbxEhq6MVpzcJt3RxD4Nnowuq6SHJgK2CaCDA5jRt9IH6l LIyYR9K6zcfgowLDlXTkBmP0XVrPgwF14t7/LD70GXIjZaoTkEH7NQlPtOzpRUj5GxTTvS KVthg38BW3kCCbh7kide9KbuM4uyZOw= X-MC-Unique: 19ZB4_sGOZ6LtnAp6MBfxA-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 1/7] util: alloc: Remove VIR_ALLOC_QUIET Date: Thu, 10 Sep 2020 13:29:19 +0200 Message-Id: <20200910112925.118651-2-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.001 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: Tim Wiederhake --- src/rpc/virnetmessage.c | 2 +- src/util/viralloc.h | 14 -------------- src/util/virbitmap.c | 2 +- src/util/virerror.c | 6 +++--- src/util/virlog.c | 2 +- src/util/virthread.c | 2 +- tests/virpcimock.c | 6 +++--- 7 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/rpc/virnetmessage.c b/src/rpc/virnetmessage.c index c4ddafc01d..011b32b100 100644 --- a/src/rpc/virnetmessage.c +++ b/src/rpc/virnetmessage.c @@ -539,7 +539,7 @@ void virNetMessageSaveError(virNetMessageErrorPtr rerr) } else { rerr->code =3D VIR_ERR_INTERNAL_ERROR; rerr->domain =3D VIR_FROM_RPC; - if (VIR_ALLOC_QUIET(rerr->message) =3D=3D 0) + if (VIR_ALLOC(rerr->message) =3D=3D 0) *rerr->message =3D g_strdup(_("Library function returned error= but did not set virError")); rerr->level =3D VIR_ERR_ERROR; } diff --git a/src/util/viralloc.h b/src/util/viralloc.h index 833f85f62e..ae967f2556 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -75,20 +75,6 @@ void virDisposeString(char **strptr) */ #define VIR_ALLOC(ptr) virAlloc(&(ptr), sizeof(*(ptr))) =20 -/** - * VIR_ALLOC_QUIET: - * @ptr: pointer to hold address of allocated memory - * - * Allocate sizeof(*ptr) bytes of memory and store - * the address of allocated memory in 'ptr'. Fill the - * newly allocated memory with zeros. - * - * This macro is safe to use on arguments with side effects. - * - * Returns 0 on success, aborts on OOM - */ -#define VIR_ALLOC_QUIET(ptr) VIR_ALLOC(ptr) - /** * VIR_ALLOC_N: * @ptr: pointer to hold address of allocated memory diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 60fd8491dd..7198bfa66e 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -69,7 +69,7 @@ virBitmapNewQuiet(size_t size) =20 sz =3D VIR_DIV_UP(size, VIR_BITMAP_BITS_PER_UNIT); =20 - if (VIR_ALLOC_QUIET(bitmap) < 0) + if (VIR_ALLOC(bitmap) < 0) return NULL; =20 if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) { diff --git a/src/util/virerror.c b/src/util/virerror.c index 507a29f50f..fc9e10c649 100644 --- a/src/util/virerror.c +++ b/src/util/virerror.c @@ -225,7 +225,7 @@ virErrorCopyNew(virErrorPtr err) { virErrorPtr ret; =20 - if (VIR_ALLOC_QUIET(ret) < 0) + if (VIR_ALLOC(ret) < 0) return NULL; =20 if (virCopyError(err, ret) < 0) @@ -241,7 +241,7 @@ virLastErrorObject(void) virErrorPtr err; err =3D virThreadLocalGet(&virLastErr); if (!err) { - if (VIR_ALLOC_QUIET(err) < 0) + if (VIR_ALLOC(err) < 0) return NULL; if (virThreadLocalSet(&virLastErr, err) < 0) VIR_FREE(err); @@ -404,7 +404,7 @@ virSaveLastError(void) virErrorPtr to; int saved_errno =3D errno; =20 - if (VIR_ALLOC_QUIET(to) < 0) + if (VIR_ALLOC(to) < 0) return NULL; =20 virCopyLastError(to); diff --git a/src/util/virlog.c b/src/util/virlog.c index f6d0c6c050..b368ce23f3 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1327,7 +1327,7 @@ virLogFilterNew(const char *match, memcpy(mdup + 1, match, mlen); mdup[mlen + 1] =3D '*'; =20 - if (VIR_ALLOC_QUIET(ret) < 0) { + if (VIR_ALLOC(ret) < 0) { VIR_FREE(mdup); return NULL; } diff --git a/src/util/virthread.c b/src/util/virthread.c index 7f23399835..c35b918c17 100644 --- a/src/util/virthread.c +++ b/src/util/virthread.c @@ -253,7 +253,7 @@ int virThreadCreateFull(virThreadPtr thread, =20 if ((err =3D pthread_attr_init(&attr)) !=3D 0) goto cleanup; - if (VIR_ALLOC_QUIET(args) < 0) { + if (VIR_ALLOC(args) < 0) { err =3D ENOMEM; goto cleanup; } diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 92b6f810d8..76818d0031 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -427,7 +427,7 @@ pci_device_create_iommu(const struct pciDevice *dev, return; } =20 - if (VIR_ALLOC_QUIET(iommuGroup) < 0) + if (VIR_ALLOC(iommuGroup) < 0) ABORT_OOM(); =20 iommuGroup->iommu =3D dev->iommuGroup; @@ -469,7 +469,7 @@ pci_device_new_from_stub(const struct pciDevice *data) c =3D strchr(c, ':'); } =20 - if (VIR_ALLOC_QUIET(dev) < 0) + if (VIR_ALLOC(dev) < 0) ABORT_OOM(); =20 configSrc =3D g_strdup_printf("%s/virpcitestdata/%s.config", abs_srcdi= r, id); @@ -694,7 +694,7 @@ pci_driver_new(const char *name, ...) int vendor, device; g_autofree char *driverpath =3D NULL; =20 - if (VIR_ALLOC_QUIET(driver) < 0) + if (VIR_ALLOC(driver) < 0) ABORT_OOM(); driver->name =3D g_strdup(name); if (!(driverpath =3D pci_driver_get_path(driver, NULL, true))) --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1599737549; cv=none; d=zohomail.com; s=zohoarc; b=RGtj8cGRV56Yw5NMxC1yG+OUjQPuNFducYtwHS+PdE+f9yYNzMez9fQYrmqZ2zaJE7eRThzSqaHyh/Ezgt82LxC04StDVrwMfgx3RtY1vID5WlRzLvZzm0kQOIjyE7xKriyJd3rNEoEem1zT1uu/0SSWzB9jyObDH9RGkXgmBYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737549; h=Content-Type:Content-Transfer-Encoding:Cc: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=swuqpTrYQYibimo5AJI2D0qowEjyp7LIemyPBEU+9AY=; b=Ojn4DYirNXmFmrwCyXSKxded2QjDtpAfpseCzEzSRp9BXWuPd8+M8SEKAoOA9KB3M/g7d/C7+KFWzDQGNZX27Nuc0a8WLKcUfsSFR7jBICOvbEezpiIHnjLcl4KZsCEjO9Mn7ilKe0xcWW4WpMhhFQuDK0Uti2b15q6nglU+lKM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599737549118805.5500823726004; Thu, 10 Sep 2020 04:32: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-90-DfwWLMGhMoeBPPRf5WMS2w-1; Thu, 10 Sep 2020 07:32:24 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 09CBB802B7C; Thu, 10 Sep 2020 11:32:20 +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 DA6981002D62; Thu, 10 Sep 2020 11:32: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 A7386181A6DF; Thu, 10 Sep 2020 11:32:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTWZt028228 for ; Thu, 10 Sep 2020 07:29:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8A77B5C230; Thu, 10 Sep 2020 11:29:32 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id BEE5B5C1CF; Thu, 10 Sep 2020 11:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737546; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=swuqpTrYQYibimo5AJI2D0qowEjyp7LIemyPBEU+9AY=; b=gfCvGK2dDTXIZf/esRETNz7eQ0E5sdc+Gmu/SIZdtrww1Gt4q3uUsiW7XOEE9UDbNAa1Ny 1+v9WUKuaPtPYfMDOJoRh2A/8GORihuosvKa+qWraaZZa15OgtTykeAzxgyx//qmkDV4og InTVCC4JSSHSo1spe+vvROesYFMc5ZI= X-MC-Unique: DfwWLMGhMoeBPPRf5WMS2w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 2/7] util: alloc: Remove VIR_ALLOC_N_QUIET Date: Thu, 10 Sep 2020 13:29:20 +0200 Message-Id: <20200910112925.118651-3-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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: Tim Wiederhake --- src/util/viralloc.h | 15 --------------- src/util/virbitmap.c | 2 +- src/util/virdevmapper.c | 2 +- src/util/virjson.c | 2 +- src/util/virlog.c | 2 +- tests/virconftest.c | 2 +- 6 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/util/viralloc.h b/src/util/viralloc.h index ae967f2556..c60148724d 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -90,21 +90,6 @@ void virDisposeString(char **strptr) */ #define VIR_ALLOC_N(ptr, count) virAllocN(&(ptr), sizeof(*(ptr)), (count)) =20 -/** - * VIR_ALLOC_N_QUIET: - * @ptr: pointer to hold address of allocated memory - * @count: number of elements to allocate - * - * Allocate an array of 'count' elements, each sizeof(*ptr) - * bytes long and store the address of allocated memory in - * 'ptr'. Fill the newly allocated memory with zeros. - * - * This macro is safe to use on arguments with side effects. - * - * Returns 0 on success, aborts on OOM - */ -#define VIR_ALLOC_N_QUIET(ptr, count) VIR_ALLOC_N(ptr, count) - /** * VIR_REALLOC_N: * @ptr: pointer to hold address of allocated memory diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c index 7198bfa66e..35ca914ce2 100644 --- a/src/util/virbitmap.c +++ b/src/util/virbitmap.c @@ -72,7 +72,7 @@ virBitmapNewQuiet(size_t size) if (VIR_ALLOC(bitmap) < 0) return NULL; =20 - if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) { + if (VIR_ALLOC_N(bitmap->map, sz) < 0) { VIR_FREE(bitmap); return NULL; } diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c index 7c89c2a952..3c45d3b7f5 100644 --- a/src/util/virdevmapper.c +++ b/src/util/virdevmapper.c @@ -260,7 +260,7 @@ virDevMapperGetTargetsImpl(int controlFD, return -1; } =20 - if (VIR_ALLOC_N_QUIET(devPaths, deps->count + 1) < 0) + if (VIR_ALLOC_N(devPaths, deps->count + 1) < 0) return -1; =20 for (i =3D 0; i < deps->count; i++) { diff --git a/src/util/virjson.c b/src/util/virjson.c index 6921eccb60..cdaca20628 100644 --- a/src/util/virjson.c +++ b/src/util/virjson.c @@ -1243,7 +1243,7 @@ virJSONValueGetArrayAsBitmap(const virJSONValue *val, if (val->type !=3D VIR_JSON_TYPE_ARRAY) return -1; =20 - if (VIR_ALLOC_N_QUIET(elems, val->data.array.nvalues) < 0) + if (VIR_ALLOC_N(elems, val->data.array.nvalues) < 0) return -1; =20 /* first pass converts array members to numbers and finds the maximum = */ diff --git a/src/util/virlog.c b/src/util/virlog.c index b368ce23f3..677ba1dfac 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -1320,7 +1320,7 @@ virLogFilterNew(const char *match, /* We must treat 'foo' as equiv to '*foo*' for g_pattern_match * todo substring matches, so add 2 extra bytes */ - if (VIR_ALLOC_N_QUIET(mdup, mlen + 3) < 0) + if (VIR_ALLOC_N(mdup, mlen + 3) < 0) return NULL; =20 mdup[0] =3D '*'; diff --git a/tests/virconftest.c b/tests/virconftest.c index ab29b5b712..3ae4d4ecc0 100644 --- a/tests/virconftest.c +++ b/tests/virconftest.c @@ -42,7 +42,7 @@ static int testConfRoundTrip(const void *opaque) srcfile =3D g_strdup_printf("%s/virconfdata/%s.conf", abs_srcdir, name= ); dstfile =3D g_strdup_printf("%s/virconfdata/%s.out", abs_srcdir, name); =20 - if (VIR_ALLOC_N_QUIET(buffer, len) < 0) { + if (VIR_ALLOC_N(buffer, len) < 0) { fprintf(stderr, "out of memory\n"); goto cleanup; } --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.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 (zohomail.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=1599737584; cv=none; d=zohomail.com; s=zohoarc; b=D2fv+EbAJ8cDx5H4zb1+GAKq+BH5T3/Pzsk+QEkZYAhQ01Bkx04PPR6CAcnLLa9i+FedLR/VPOFEvPxu0F1684ozY1uFJd4TUKjvvMSqnfzVN0Zs0CEDLEFhV1W0qc1rGsujrGn9qbGYkdCuUwcJigAeAsTomuESVInKVuiXwPM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737584; h=Content-Type:Content-Transfer-Encoding:Cc: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=w7Cic8HekWnC7qlis8HDRZugSfIWX9GsqE2hxQ9xO/8=; b=MPjOu5bJcbdkkZ3d+O79r4LtTS99kVecYrpVhUiRjl7fw1y5EN3Yhpq7FgpIf4c/efjn9LSasgTe0fu8R4zRVHKllpkkLS/faLBH1i3vMAK1+koncGdlELt00KqBRyA81wms2DEiAhDVAm230hSX/M80ZgNT34mDCfAIcvPogFI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.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 (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599737584706941.0998901455766; Thu, 10 Sep 2020 04:33: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-380-Z-T0OmwQMzehHpFA6_d7Fw-1; Thu, 10 Sep 2020 07:32:28 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DC7578030AA; Thu, 10 Sep 2020 11:32:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B898627BCF; Thu, 10 Sep 2020 11:32:22 +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 89DD7922E8; Thu, 10 Sep 2020 11:32:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTXGY028236 for ; Thu, 10 Sep 2020 07:29:33 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9985F5C230; Thu, 10 Sep 2020 11:29:33 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id E0DC85C1CF; Thu, 10 Sep 2020 11:29:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737582; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=w7Cic8HekWnC7qlis8HDRZugSfIWX9GsqE2hxQ9xO/8=; b=hrDu47fZt93iuKatboKu5n9kNejffEbTy3MfITm5uuw/+CdV/5JMQ19gy8D0cSRCcWooJH iXcM3xkMQWZ94cLhMgV0ojFe+LBOaa1z3zR2RlVNv+bYlB3XV1MAZ8EgkCEagkTaBslR2M XP3m0MjCtqyZWe6sMixl32APA01Pmp0= X-MC-Unique: Z-T0OmwQMzehHpFA6_d7Fw-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 3/7] util: alloc: Remove VIR_REALLOC_N_QUIET Date: Thu, 10 Sep 2020 13:29:21 +0200 Message-Id: <20200910112925.118651-4-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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: Tim Wiederhake --- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_process.c | 2 +- src/util/viralloc.h | 15 --------------- src/util/virfile.c | 2 +- tests/virpcimock.c | 6 +++--- tools/vsh.c | 2 +- 6 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0ed132a829..9719636a2a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -511,7 +511,7 @@ qemuDomainMasterKeyReadFile(qemuDomainObjPrivatePtr pri= v) goto error; } =20 - ignore_value(VIR_REALLOC_N_QUIET(masterKey, masterKeyLen)); + ignore_value(VIR_REALLOC_N(masterKey, masterKeyLen)); =20 priv->masterKey =3D masterKey; priv->masterKeyLen =3D masterKeyLen; @@ -6357,7 +6357,7 @@ ssize_t qemuDomainLogContextRead(qemuDomainLogContext= Ptr ctxt, =20 buf[got] =3D '\0'; =20 - ignore_value(VIR_REALLOC_N_QUIET(buf, got + 1)); + ignore_value(VIR_REALLOC_N(buf, got + 1)); buflen =3D got; } =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dd60fb0ddf..42a5d3ce19 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -2082,7 +2082,7 @@ qemuProcessReadLog(qemuDomainLogContextPtr logCtxt, got -=3D skip; } =20 - ignore_value(VIR_REALLOC_N_QUIET(buf, got + 1)); + ignore_value(VIR_REALLOC_N(buf, got + 1)); *msg =3D buf; return 0; } diff --git a/src/util/viralloc.h b/src/util/viralloc.h index c60148724d..a50cd5d632 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -105,21 +105,6 @@ void virDisposeString(char **strptr) */ #define VIR_REALLOC_N(ptr, count) virReallocN(&(ptr), sizeof(*(ptr)), (cou= nt)) =20 -/** - * VIR_REALLOC_N_QUIET: - * @ptr: pointer to hold address of allocated memory - * @count: number of elements to allocate - * - * Re-allocate an array of 'count' elements, each sizeof(*ptr) - * bytes long and store the address of allocated memory in - * 'ptr'. If 'ptr' grew, the added memory is uninitialized. - * - * This macro is safe to use on arguments with side effects. - * - * Returns 0 on success, aborts on OOM - */ -#define VIR_REALLOC_N_QUIET(ptr, count) VIR_REALLOC_N(ptr, count) - /** * VIR_EXPAND_N: * @ptr: pointer to hold address of allocated memory diff --git a/src/util/virfile.c b/src/util/virfile.c index 90156845df..716ffdf7b6 100644 --- a/src/util/virfile.c +++ b/src/util/virfile.c @@ -4339,7 +4339,7 @@ virFileGetXAttrQuiet(const char *path, if ((need =3D getxattr(path, name, NULL, 0)) < 0) goto cleanup; =20 - if (VIR_REALLOC_N_QUIET(buf, need + 1) < 0) + if (VIR_REALLOC_N(buf, need + 1) < 0) goto cleanup; =20 if ((got =3D getxattr(path, name, buf, need)) < 0) { diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 76818d0031..30a31cb5de 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -305,7 +305,7 @@ add_fd(int fd, const char *path) fd, path, cb.fd, cb.path); } =20 - if (VIR_REALLOC_N_QUIET(callbacks, nCallbacks + 1) < 0) { + if (VIR_REALLOC_N(callbacks, nCallbacks + 1) < 0) { errno =3D ENOMEM; return -1; } @@ -709,8 +709,8 @@ pci_driver_new(const char *name, ...) if ((device =3D va_arg(args, int)) =3D=3D -1) ABORT("Invalid vendor device pair for driver %s", name); =20 - if (VIR_REALLOC_N_QUIET(driver->vendor, driver->len + 1) < 0 || - VIR_REALLOC_N_QUIET(driver->device, driver->len + 1) < 0) + if (VIR_REALLOC_N(driver->vendor, driver->len + 1) < 0 || + VIR_REALLOC_N(driver->device, driver->len + 1) < 0) ABORT_OOM(); =20 driver->vendor[driver->len] =3D vendor; diff --git a/tools/vsh.c b/tools/vsh.c index 0e8edcd78c..345458a0e2 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -2723,7 +2723,7 @@ vshCompleterFilter(char ***list, newList_len++; } =20 - ignore_value(VIR_REALLOC_N_QUIET(newList, newList_len + 1)); + ignore_value(VIR_REALLOC_N(newList, newList_len + 1)); VIR_FREE(*list); *list =3D newList; return 0; --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1599737488; cv=none; d=zohomail.com; s=zohoarc; b=hpOzqqLIn7LJfeiDlL9GmxUh1wQn5DZc9U17aMG95yciTWXtXiAHotfihpMKzhv+8B4kXsn6wXHYqv7PSE55X8wuLKHgtHAraqCIwIZK7v5mwf0HomJSQoRhULP6KH1QKLOCY3GLv4qls0/OzgKzTnlx3Edu2jh2L/hyz5PMYeA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737488; h=Content-Type:Content-Transfer-Encoding:Cc: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=gGDYrn3zvwxBBCHRFsnWvTY78HYMe/ZuMnlqnhQodYU=; b=ARwKgr/WjEsvMUWECb7q9nrVt93P/H7mAtjEh/tXgngUclgJJuuE70RcQOyPs0M/XV3cX6/xDGTlaTuvJzYlhMp0UE+tXdD5PbRhkZXVs0SxuYIeZNlBgOSbQsR44GUlJu+NwMoGg1j2KUxtqfj58oOURUbmH9QQ0XXm4C7Yu3Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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 (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599737488421227.39025118110612; Thu, 10 Sep 2020 04:31:28 -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-408-2GuTKNJTNvW00GAhxHmTrQ-1; Thu, 10 Sep 2020 07:31:24 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3CD1B185FD70; Thu, 10 Sep 2020 11:31:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1185527BDD; Thu, 10 Sep 2020 11:31: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 9ADC5922E8; Thu, 10 Sep 2020 11:31:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTY5P028254 for ; Thu, 10 Sep 2020 07:29:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id A9FCF5C221; Thu, 10 Sep 2020 11:29:34 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC4D05C1CF; Thu, 10 Sep 2020 11:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737486; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=gGDYrn3zvwxBBCHRFsnWvTY78HYMe/ZuMnlqnhQodYU=; b=WmznD6jeyWcYbtW4eWqKx4RsDBCiipjkiOa9See4W+9uxuMUaX0sNhkfhUsL7b3+dQ/Kfa ySY+oW9EdzFlVfe9Ksy4nIAeavPQJDSSZRCjl+wh9yhsSHhcmlv9xla8qkwubjJIgWRB7x a5i5HhVIq/uZJ8TWZbVvTkgZbRA7/aE= X-MC-Unique: 2GuTKNJTNvW00GAhxHmTrQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 4/7] util: alloc: Remove VIR_APPEND_ELEMENT_QUIET Date: Thu, 10 Sep 2020 13:29:22 +0200 Message-Id: <20200910112925.118651-5-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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: Tim Wiederhake --- src/util/viralloc.h | 4 ---- tests/virfilewrapper.c | 4 ++-- tests/virpcimock.c | 7 +++---- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/util/viralloc.h b/src/util/viralloc.h index a50cd5d632..a581a2935e 100644 --- a/src/util/viralloc.h +++ b/src/util/viralloc.h @@ -303,10 +303,6 @@ void virDisposeString(char **strptr) VIR_TYPEMATCH(ptr, &(newelem)), \ &(newelem), false, true)) =20 -/* Quiet version of macros above */ -#define VIR_APPEND_ELEMENT_QUIET(ptr, count, newelem) \ - VIR_APPEND_ELEMENT(ptr, count, newelem) - /** * VIR_DELETE_ELEMENT: * @ptr: pointer to array of objects (*not* ptr to ptr) diff --git a/tests/virfilewrapper.c b/tests/virfilewrapper.c index 0500a3617e..ca7274bfe7 100644 --- a/tests/virfilewrapper.c +++ b/tests/virfilewrapper.c @@ -74,8 +74,8 @@ virFileWrapperAddPrefix(const char *prefix, =20 init_syms(); =20 - if (VIR_APPEND_ELEMENT_QUIET(prefixes, nprefixes, prefix) < 0 || - VIR_APPEND_ELEMENT_QUIET(overrides, noverrides, override) < 0) { + if (VIR_APPEND_ELEMENT(prefixes, nprefixes, prefix) < 0 || + VIR_APPEND_ELEMENT(overrides, noverrides, override) < 0) { VIR_FREE(prefixes); VIR_FREE(overrides); fprintf(stderr, "Unable to add path override for '%s'\n", prefix); diff --git a/tests/virpcimock.c b/tests/virpcimock.c index 30a31cb5de..b29f34bc4f 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -433,8 +433,7 @@ pci_device_create_iommu(const struct pciDevice *dev, iommuGroup->iommu =3D dev->iommuGroup; iommuGroup->nDevicesBoundToVFIO =3D 0; /* No device bound to VFIO by d= efault */ =20 - if (VIR_APPEND_ELEMENT_QUIET(pciIommuGroups, npciIommuGroups, - iommuGroup) < 0) + if (VIR_APPEND_ELEMENT(pciIommuGroups, npciIommuGroups, iommuGroup) < = 0) ABORT_OOM(); } =20 @@ -550,7 +549,7 @@ pci_device_new_from_stub(const struct pciDevice *data) if (pci_device_autobind(dev) < 0) ABORT("Unable to bind: %s", devid); =20 - if (VIR_APPEND_ELEMENT_QUIET(pciDevices, nPCIDevices, dev) < 0) + if (VIR_APPEND_ELEMENT(pciDevices, nPCIDevices, dev) < 0) ABORT_OOM(); } =20 @@ -723,7 +722,7 @@ pci_driver_new(const char *name, ...) make_file(driverpath, "bind", NULL, -1); make_file(driverpath, "unbind", NULL, -1); =20 - if (VIR_APPEND_ELEMENT_QUIET(pciDrivers, nPCIDrivers, driver) < 0) + if (VIR_APPEND_ELEMENT(pciDrivers, nPCIDrivers, driver) < 0) ABORT_OOM(); } =20 --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1599737507; cv=none; d=zohomail.com; s=zohoarc; b=hK3n3yeMLIP8Y5OhlVg73sESMBHMCaEmm2e+/+Oh1/eNwucax3D5x/6B+We+kqKVZ2IdYr6eqa8LwHQQ6D2PlxiaflwDAvsK7LmIu22IGgXH160oa3O2RL2W9uPOaTETrCoQX8n0Sbo6bQyfwAKkviOUcszhN3SuepCgNAT1NvA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737507; h=Content-Type:Content-Transfer-Encoding:Cc: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=xGJquPcHxHzW+Tvkw/8YjM25CRKmZpCtVXE0/7FRF8c=; b=Dt7EK4FWuQIYlCxkgp19FcskFg5veVS5/jBC9qsfTc/dP3W43a/TSsTY48Tlz8fll1XtpnfvVLkoJdhXGDRP1Y6muDoo00EFSj4LQiURu9AG5lMiCw4BojnX6OU4Q8AljSzbb2RCD1NKz730sQSpkcFUPj4C2Eoyuf8wkO+JXB0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599737507604104.23267243280497; Thu, 10 Sep 2020 04:31:47 -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-508-jfwRfV9ENM-wVMdCvkad1w-1; Thu, 10 Sep 2020 07:31:44 -0400 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 A0E99807351; Thu, 10 Sep 2020 11:31:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 59E6C60BF1; Thu, 10 Sep 2020 11:31:39 +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 2A071922E8; Thu, 10 Sep 2020 11:31:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTcJ7028271 for ; Thu, 10 Sep 2020 07:29:38 -0400 Received: by smtp.corp.redhat.com (Postfix) id 53FB95C230; Thu, 10 Sep 2020 11:29:38 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 911465C221; Thu, 10 Sep 2020 11:29:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737506; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=xGJquPcHxHzW+Tvkw/8YjM25CRKmZpCtVXE0/7FRF8c=; b=MniC/VssBldEU8o/eGnGAtp+coOspW/BSPnQCBV9ezlmvZcuUGUCrJ4nZ6jwQeaTw1jEj1 hdDVn2XbznCE3Qp4ej/B3TabXfGPxkNKbq0Lr5nqK5M5FAKEw3ULeyQZ5pp3vda9T3nNGr nWx2ZuGP0c7VNTivr16aauabtYTNkEI= X-MC-Unique: jfwRfV9ENM-wVMdCvkad1w-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 5/7] cpu: Replace VIR_ALLOC with g_new0 Date: Thu, 10 Sep 2020 13:29:23 +0200 Message-Id: <20200910112925.118651-6-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.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: Tim Wiederhake --- src/cpu/cpu.c | 4 +--- src/cpu/cpu_ppc64.c | 25 ++++++++----------------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index 69e4205e4b..c3eef52c79 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -286,9 +286,7 @@ virCPUDataNew(virArch arch) { virCPUDataPtr data; =20 - if (VIR_ALLOC(data) < 0) - return NULL; - + data =3D g_new0(virCPUData, 1); data->arch =3D arch; =20 return data; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 28fbfea9ae..ca2cfa0a67 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -189,9 +189,7 @@ ppc64ModelCopy(const virCPUppc64Model *model) { g_autoptr(virCPUppc64Model) copy =3D NULL; =20 - if (VIR_ALLOC(copy) < 0) - return NULL; - + copy =3D g_new0(virCPUppc64Model, 1); copy->name =3D g_strdup(model->name); =20 if (ppc64DataCopy(©->data, &model->data) < 0) @@ -283,9 +281,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED, virCPUppc64MapPtr map =3D data; g_autoptr(virCPUppc64Vendor) vendor =3D NULL; =20 - if (VIR_ALLOC(vendor) < 0) - return -1; - + vendor =3D g_new0(virCPUppc64Vendor, 1); vendor->name =3D g_strdup(name); =20 if (ppc64VendorFind(map, vendor->name)) { @@ -314,9 +310,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, size_t i; int n; =20 - if (VIR_ALLOC(model) < 0) - return -1; - + model =3D g_new0(virCPUppc64Model, 1); model->name =3D g_strdup(name); =20 if (ppc64ModelFind(map, model->name)) { @@ -386,8 +380,7 @@ ppc64LoadMap(void) { g_autoptr(virCPUppc64Map) map =3D NULL; =20 - if (VIR_ALLOC(map) < 0) - return NULL; + map =3D g_new0(virCPUppc64Map, 1); =20 if (cpuMapLoad("ppc64", ppc64VendorParse, NULL, ppc64ModelParse, map) = < 0) return NULL; @@ -399,17 +392,15 @@ static virCPUDataPtr ppc64MakeCPUData(virArch arch, virCPUppc64Data *data) { - virCPUDataPtr cpuData; - - if (VIR_ALLOC(cpuData) < 0) - return NULL; + g_autoptr(virCPUData) cpuData =3D NULL; =20 + cpuData =3D g_new0(virCPUData, 1); cpuData->arch =3D arch; =20 if (ppc64DataCopy(&cpuData->data.ppc64, data) < 0) - VIR_FREE(cpuData); + return NULL; =20 - return cpuData; + return g_steal_pointer(&cpuData); } =20 static virCPUCompareResult --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 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=1599737515; cv=none; d=zohomail.com; s=zohoarc; b=jGoc55gwLR1Q+3/LlILc+b/J9zJRwuUk/nPaSxDeTrQk2YsGGMZE/Wx5ViUx93gBo3BZEZYPiS115DZyf5cy0WOs7pvJfKqF2g3QBAFCfl6IEW3xUQoz8lBt5gYDKp8RMueBzcUQxSd7vyn3i507MtvQBoJKAHIHhMmJW9dR6Vg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737515; h=Content-Type:Content-Transfer-Encoding:Cc: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=8RU96R37KqClhTE2rja28jrH4btn+iJdhyMW7aO3zKU=; b=PXl9HAWFNeNq+9iiWRUfFf+Cu/nBCBErd8rcW2Ck49O4oYaduonaFWU3SiJtwwMsKXyAYrpH6QfjQ28Dm8xcOqdeN/dYmf2r7SnpfN8eWfoP3DbaTAD9lORAeiEtKSJycWx2tCliE1mQq7QGp4zgXXN+Vzvfp+JGpf+JuBBjyuA= 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 1599737514956610.2878253328003; Thu, 10 Sep 2020 04:31:54 -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-451-kKyORhvuORGro4LMXzWIDQ-1; Thu, 10 Sep 2020 07:31:48 -0400 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 F1D491DE01; Thu, 10 Sep 2020 11:31:41 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D303F60C87; Thu, 10 Sep 2020 11:31:41 +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 A2C40922F1; Thu, 10 Sep 2020 11:31:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTdOt028277 for ; Thu, 10 Sep 2020 07:29:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 616A45C221; Thu, 10 Sep 2020 11:29:39 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id A641F5C1CF; Thu, 10 Sep 2020 11:29:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737510; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8RU96R37KqClhTE2rja28jrH4btn+iJdhyMW7aO3zKU=; b=NG5goHBRF5nqS/yzJrOw/p5bgzJHJejm+QCFwF42SSQ+dtaDhzGBVuNsWijqCk9CMgNm9I APnZC1bHbiGs8byaITtydmKuIc8oP8NrYz/xK3e/+CO+T6EGTtA5RMdcWtnTeJLExGBMMw zQF78lRr0k7ZWHodo0CuV4LdvFBy7Xc= X-MC-Unique: kKyORhvuORGro4LMXzWIDQ-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 6/7] cpu: Replace VIR_ALLOC_N with g_new0 Date: Thu, 10 Sep 2020 13:29:24 +0200 Message-Id: <20200910112925.118651-7-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.001 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: Tim Wiederhake Reviewed-by: J=C3=A1n Tomko --- src/cpu/cpu_ppc64.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index ca2cfa0a67..6477b4bce7 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -134,9 +134,7 @@ ppc64DataCopy(virCPUppc64Data *dst, const virCPUppc64Da= ta *src) { size_t i; =20 - if (VIR_ALLOC_N(dst->pvr, src->len) < 0) - return -1; - + dst->pvr =3D g_new0(virCPUppc64PVR, src->len); dst->len =3D src->len; =20 for (i =3D 0; i < src->len; i++) { @@ -343,9 +341,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt, return -1; } =20 - if (VIR_ALLOC_N(model->data.pvr, n) < 0) - return -1; - + model->data.pvr =3D g_new0(virCPUppc64PVR, n); model->data.len =3D n; =20 for (i =3D 0; i < n; i++) { @@ -603,10 +599,7 @@ virCPUppc64GetHost(virCPUDefPtr cpu, return -1; =20 data =3D &cpuData->data.ppc64; - - if (VIR_ALLOC_N(data->pvr, 1) < 0) - return -1; - + data->pvr =3D g_new0(virCPUppc64PVR, 1); data->len =3D 1; =20 #if defined(__powerpc__) || defined(__powerpc64__) @@ -732,8 +725,7 @@ virCPUppc64DriverGetModels(char ***models) return -1; =20 if (models) { - if (VIR_ALLOC_N(*models, map->nmodels + 1) < 0) - return -1; + *models =3D g_new0(char*, map->nmodels + 1); =20 for (i =3D 0; i < map->nmodels; i++) (*models)[i] =3D g_strdup(map->models[i]->name); --=20 2.26.2 From nobody Thu Apr 18 06:52:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1599737953; cv=none; d=zohomail.com; s=zohoarc; b=QWBdfHBSAdVwYX8m+n93GnmkO5tmSB8dNXWy++QZNcMp4Pj+WWNp9m5ugJ7nHkb548yuXAnn49WsjfSb5d6Ylp7n4pZ3IxOleXMrMJxXtqn8+MiGlGyhZOBnjkn0S5DQp76CXpuqojYhmhj+83VnmPOaSP6aKF6ITLaOd9DY5ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599737953; h=Content-Type:Content-Transfer-Encoding:Cc: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=PIn4LVhvx+ndVe9fH0R+DWMK9VziTycbLFsupS+vV8g=; b=QjfmNjGyRk2FJQHEiyjx/rshvRx8mVphwjmIf5sh0GwqBXz0Qmwqyntou08aFx8Y/FdynKij5r22+141MiuLaEXUERIIrR5KQEMA1J/LUVeS+c1EZGWqjSPsjRAH/c0Tl+BWWmbSbfZQj/kR5aY2YaMGgfheUum1xtAq9V7B0HY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1599737953245424.81310896882974; Thu, 10 Sep 2020 04:39:13 -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-383-LZg3zndIMSGJfDitqoGg8Q-1; Thu, 10 Sep 2020 07:36:01 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60A561074652; Thu, 10 Sep 2020 11:31:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E73F81F4B; Thu, 10 Sep 2020 11:31:44 +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 103E7922F6; Thu, 10 Sep 2020 11:31:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08ABTeOS028287 for ; Thu, 10 Sep 2020 07:29:40 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7620F5C230; Thu, 10 Sep 2020 11:29:40 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-113-147.ams2.redhat.com [10.36.113.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id B42C05C1CF; Thu, 10 Sep 2020 11:29:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599737952; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=PIn4LVhvx+ndVe9fH0R+DWMK9VziTycbLFsupS+vV8g=; b=HHvqnMAV8oHJFGw7+ViqWIaPDdrtsCqVTvO8ofumS6QhHLxrAeFlZzEgRydZyt0XRdDXbv yiaNPXitSB5CtAY5lYQiZUShPEPRirLSv6XVwQ2a3czXqMTrDKv7DxymE3vxKa9DhSsIY5 MD6sOWVBdYgs/ZndziSKP5/Td974dk0= X-MC-Unique: LZg3zndIMSGJfDitqoGg8Q-1 From: Tim Wiederhake To: libvir-list@redhat.com Subject: [libvirt PATCH 7/7] cpu: Replace VIR_FREE with g_free Date: Thu, 10 Sep 2020 13:29:25 +0200 Message-Id: <20200910112925.118651-8-twiederh@redhat.com> In-Reply-To: <20200910112925.118651-1-twiederh@redhat.com> References: <20200910112925.118651-1-twiederh@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: Tim Wiederhake 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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: Tim Wiederhake --- src/cpu/cpu.c | 2 +- src/cpu/cpu_map.c | 6 +++--- src/cpu/cpu_ppc64.c | 18 +++++++++--------- src/cpu/cpu_x86.c | 10 +++++----- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/cpu/cpu.c b/src/cpu/cpu.c index c3eef52c79..188c5d86b5 100644 --- a/src/cpu/cpu.c +++ b/src/cpu/cpu.c @@ -315,7 +315,7 @@ virCPUDataFree(virCPUDataPtr data) if ((driver =3D cpuGetSubDriver(data->arch)) && driver->dataFree) driver->dataFree(data); else - VIR_FREE(data); + g_free(data); } =20 =20 diff --git a/src/cpu/cpu_map.c b/src/cpu/cpu_map.c index 65d244e011..7859eef9aa 100644 --- a/src/cpu/cpu_map.c +++ b/src/cpu/cpu_map.c @@ -64,7 +64,7 @@ loadData(const char *mapfile, VIR_DEBUG("Load %s name %s", element, name); ctxt->node =3D nodes[i]; rv =3D callback(ctxt, name, data); - VIR_FREE(name); + g_free(name); if (rv < 0) return -1; } @@ -133,10 +133,10 @@ loadIncludes(xmlXPathContextPtr ctxt, } VIR_DEBUG("Finding CPU map include '%s'", filename); if (cpuMapLoadInclude(filename, vendorCB, featureCB, modelCB, data= ) < 0) { - VIR_FREE(filename); + g_free(filename); return -1; } - VIR_FREE(filename); + g_free(filename); } =20 return 0; diff --git a/src/cpu/cpu_ppc64.c b/src/cpu/cpu_ppc64.c index 6477b4bce7..7a36981e12 100644 --- a/src/cpu/cpu_ppc64.c +++ b/src/cpu/cpu_ppc64.c @@ -126,7 +126,7 @@ ppc64DataClear(virCPUppc64Data *data) if (!data) return; =20 - VIR_FREE(data->pvr); + g_free(data->pvr); } =20 static int @@ -151,8 +151,8 @@ ppc64VendorFree(virCPUppc64VendorPtr vendor) if (!vendor) return; =20 - VIR_FREE(vendor->name); - VIR_FREE(vendor); + g_free(vendor->name); + g_free(vendor); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Vendor, ppc64VendorFree); =20 @@ -177,8 +177,8 @@ ppc64ModelFree(virCPUppc64ModelPtr model) return; =20 ppc64DataClear(&model->data); - VIR_FREE(model->name); - VIR_FREE(model); + g_free(model->name); + g_free(model); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Model, ppc64ModelFree); =20 @@ -261,13 +261,13 @@ ppc64MapFree(virCPUppc64MapPtr map) =20 for (i =3D 0; i < map->nmodels; i++) ppc64ModelFree(map->models[i]); - VIR_FREE(map->models); + g_free(map->models); =20 for (i =3D 0; i < map->nvendors; i++) ppc64VendorFree(map->vendors[i]); - VIR_FREE(map->vendors); + g_free(map->vendors); =20 - VIR_FREE(map); + g_free(map); } G_DEFINE_AUTOPTR_CLEANUP_FUNC(virCPUppc64Map, ppc64MapFree); =20 @@ -584,7 +584,7 @@ virCPUppc64DataFree(virCPUDataPtr data) return; =20 ppc64DataClear(&data->data.ppc64); - VIR_FREE(data); + g_free(data); } =20 =20 diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index fdb665b01d..6a46e186ce 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -493,7 +493,7 @@ virCPUx86DataFree(virCPUDataPtr data) return; =20 virCPUx86DataClear(&data->data.x86); - VIR_FREE(data); + g_free(data); } =20 =20 @@ -1805,7 +1805,7 @@ virCPUx86DataParse(xmlXPathContextPtr ctxt) if (message) \ *message =3D g_strdup_printf("%s: %s", _(MSG), flagsStr); \ VIR_DEBUG("%s: %s", MSG, flagsStr); \ - VIR_FREE(flagsStr); \ + g_free(flagsStr); \ } while (0) =20 =20 @@ -2208,7 +2208,7 @@ x86Decode(virCPUDefPtr cpu, if (x86FeatureIsMigratable(cpuModel->features[i].name, map)) { i++; } else { - VIR_FREE(cpuModel->features[i].name); + g_free(cpuModel->features[i].name); VIR_DELETE_ELEMENT_INPLACE(cpuModel->features, i, cpuModel->nfeatures); } @@ -2893,7 +2893,7 @@ virCPUx86Baseline(virCPUDefPtr *cpus, cpu->fallback =3D VIR_CPU_FALLBACK_FORBID; =20 if (!outputVendor) - VIR_FREE(cpu->vendor); + g_clear_pointer(&cpu->vendor, g_free); =20 return g_steal_pointer(&cpu); } @@ -2915,7 +2915,7 @@ x86UpdateHostModel(virCPUDefPtr guest, return -1; =20 if (guest->vendor_id) { - VIR_FREE(updated->vendor_id); + g_free(updated->vendor_id); updated->vendor_id =3D g_strdup(guest->vendor_id); } =20 --=20 2.26.2